Dwarf Fortress Bug Tracker - Dwarf Fortress
View Issue Details
0011087Dwarf FortressDwarf Mode -- Raidspublic2019-04-25 07:302019-09-05 17:43
PCMAC OSX10.13.5
0011087: Memory leak when squad can't path to edge of map
Experienced a huge memory leak. FPS was sitting at 200, and then dropped to about 5-10 FPS consistently for 20 minutes.

This was resolved once I removed a squad from a raid(Raze) mission. One squad had already left and was waiting for the second. Several dwarfs from the second squad had left but 3 remained stuck in a tree. When I removed the squad from the mission (with the 3 tree huggers) FPS returned to normal.
No tags attached.
duplicate of 0010538assigned Detros Military with a raid mission stuck on tree destroy fps 
Issue History
2019-04-25 07:30slucerneNew Issue
2019-04-25 13:10lethosorNote Added: 0039348
2019-05-05 18:10LociAssigned To => Loci
2019-05-05 18:10LociStatusnew => needs feedback
2019-09-04 03:46slucerneNote Added: 0039505
2019-09-04 03:46slucerneStatusneeds feedback => assigned
2019-09-04 03:55slucerneNote Edited: 0039505bug_revision_view_page.php?bugnote_id=0039505#r16092
2019-09-05 01:20PatrikLundellNote Added: 0039506
2019-09-05 17:43LociNote Added: 0039507
2019-09-05 17:43LociRelationship addedduplicate of 0010538
2019-09-05 17:43LociStatusassigned => resolved
2019-09-05 17:43LociResolutionopen => duplicate

2019-04-25 13:10   
What evidence do you have that this is a memory leak as opposed to ordinary lag?
2019-09-04 03:46   
(edited on: 2019-09-04 03:55)
FPS remained at 5-10 for at least 20 real life minutes, the entire duration that the stuck dwarf, assigned to a mission, was stuck. The exact moment I relieved him from the squad, my fps returned to it's usual 200 and the mission progressed with the other dwarves already off the screen edge.

It wasn't just "meh, it feels a bit better now" it was basically unplayable, and I spent 20 minutes letting the game run, trying numerous things, changing traffic costs, sealing caverns, burrowing dwarves, the lot. Then when I found the stuck dwarf, unassigned him from the squad so the rest of his squad could start the mission (already being off the screen) the frame rate was restored drastically. The difference being dwarves moving one tile every 10 seconds, to moving faster than I can keep track of.

This has happened again since, in the past few months perhaps 2-3 times, but remembered the issue and resolved it quite quickly, same steps.

EDIT: Perhaps 'Memory leak' could be interpreted differently to other programmers. In my field of work we generally refer to anything that is running an unnecessary process as a 'memory leak', generally burning up your CPU without a good reason.

2019-09-05 01:20   
The term "Memory leak" refers to memory being allocated and never released even though it isn't used any longer (and it is standard practice in e.g. Java, where garbage collection is intended to recover memory that is no longer used, to free the scripter from having to manage memory usage). This causes the program to crash when all physical and virtual memory has been allocated and the program tries to allocate more memory.

Lag is caused by processing that burn CPU cycles, disk swapping, and other things that cause the program to progress slowly. It is known there are several issues with pathing causing lag when the game constantly tries to generate new paths as it rejects the current one, only to reject the new one immediately.
2019-09-05 17:43   
General mission/tree lag is 0010538.