Path Selection Tool memory leak
-
On 08/06/2018 at 02:05, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R19
Platform:
Language(s) : C++ ;---------
Hello,For a while now I have been trying to fix memory leaks in my plugin, without success.
Reason of this non-success is because the memory leak isn't actually happening inside of my plugin. It apparently is an issue with the Path Selection Tool.I have written the following plugin which does ... well, absolutely nothing.
// ======================== // Testing // Dummy "empty" plugin // ======================== #include "c4d.h" // Dummy IDs - for demonstration purposes only #define MYCOMMAND_PLUGIN_ID 1999999 // Dummy ID for testing purposes // ==================================== // CommandData // ==================================== class MyCommand : public CommandData { INSTANCEOF(MyCommand, CommandData) public: virtual Bool Execute(BaseDocument* doc); virtual Bool ExecuteSubID(BaseDocument* doc, Int32 subid); virtual Int32 GetState(BaseDocument* doc); virtual Bool RestoreLayout(void* secret); virtual Bool Message(Int32 type, void* data); }; Bool MyCommand::Execute(BaseDocument* doc) { return TRUE; } Bool MyCommand::ExecuteSubID(BaseDocument* doc, Int32 subid) { return TRUE; } Int32 MyCommand::GetState(BaseDocument* doc) { return CMD_ENABLED; } Bool MyCommand::RestoreLayout(void* secret) { return TRUE; } Bool MyCommand::Message(Int32 type, void* data) { return SUPER::Message(type, data); } Bool RegisterMyCommand(void) { return RegisterCommandPlugin(MYCOMMAND_PLUGIN_ID, "Testing", 0, AutoBitmap("icon.png"), "Test", NewObjClear(MyCommand)); } // ==================================== // Plugin Main // ==================================== Bool PluginStart(void) { RegisterMyCommand(); return TRUE; } void PluginEnd(void) { } Bool PluginMessage(Int32 id, void * data) { switch (id) { case C4DPL_INIT_SYS: if (!resource.Init()) return FALSE; return TRUE; case C4DMSG_PRIORITY: return TRUE; case C4DPL_BUILDMENU: break; case C4DPL_ENDACTIVITY: return TRUE; } return FALSE; }
I run the above plugin (built with R19 SDK) via debugger.
I create a default plane (20x20), make it editable, go to edge mode, enable the path selection tool via shortcut U, M, and start selecting edges. Creating new selection, adding, subtracting, ...
then I close Cinema 4D and Visual Studio mentions following memory leak.Memory Leaks Detected: p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\objects\polygonobject.cpp (12417) : Memory leak of 401 bytes () at 0000000119535480 1 blocks not freed
I then run another debug session and do exactly the same, except that I now only use the Live Selection Tool, and DO NOT engage the Path Selection Tool at any time.
Close Cinema ... no memory leaks.It seems that the more edges are selected with the Path Selection Tool the larger the memory leak is.
-
On 11/06/2018 at 05:18, xxxxxxxx wrote:
Hi,
good find! I can reproduce the leak. Thanks for making us aware, I'll pass it on to development.