Jump to content

memroy leak when paint terrain


photo

Recommended Posts

The bug has been report many times already(by me(https://developer.unigine.com/forum/topic/308-memory-leak-in-verison-2011-01-16-and-11-01) and others(https://developer.unigine.com/forum/topic/522-slow-down-while-painting-terrain-mask)).

 

Every time you press alt and left mouse button, a new BrushTool(BrushToolHeights, BrushToolDiffuse etc) class is created and saved for undo, never got time to free unless you cancel the change to terrain(strange, even if you cancel the change, the system memory still not freed).

 

In a short time(especially in paint diffuse mode) either "SystemAllocator::allocate(): can't allocate x bytes" error is occured(32bit app) or the system memory is all consumed by the editor(64bit app).

 

Do you have any plan to fix or at least confirm this bug?

Link to comment

after more work on this, I found the allocated memroy is put in heap when free, so I add limit to the num step of undo and temp around this problem, maybe you guys have better idea.

 

in eidtor_terrain.h

 

...
if(brush_tools.size() == 0 || brush_tools[brush_tools.size() - 1].brush != brush) {
if (brush_tools.size() > 25) {
	delete brush_tools[0];
	brush_tools.remove(0);
}
...
}

Link to comment
×
×
  • Create New...