Memory leaks from LoadDocument
-
On 08/09/2017 at 04:58, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R19
Platform:
Language(s) : C++ ;---------
I have encountered major memory leaks with a project I am working on, but have not been able to trace the source of it.I have managed to reduce the whole plugin to the bare minimum to reproduce the issue.
Here's the list of memory leaks I get ...Memory Leaks Detected: ../../../frameworks/cinema.framework/source/c4d_memory.h (201) : Memory leak of 16 bytes () at 000000AD18361300 ../../../frameworks/cinema_maxon.framework/source/dynamicdata.h (1340) : Memory leak of 448 bytes () at 000000AD142348C0 ../../../frameworks/cinema_maxon.framework/source/dynamicdata.h (1340) : Memory leak of 2048 bytes () at 000000AD134ECFC0 ../../../frameworks/cinema_maxon.framework/source/dynamicdata.h (2271) : Memory leak of 224 bytes () at 000000AD136FB340 ../../../frameworks/cinema_maxon.framework/source/ge_safeatomarray.h (495) : 6 Memory leaks of 32 bytes (, first leak at 000000AD1835EF80) ../../../frameworks/cinema_maxon.framework/source/listnode.h (162) : 20 Memory leaks of 48 bytes (, first leak at 000000AD0FA1F900) ../../../frameworks/core.framework/source/maxon/basearray.h (140) : Memory leak of 408 bytes () at 000000AD13F2F580 ../../../frameworks/core.framework/source/maxon/basearray.h (140) : Memory leak of 432 bytes () at 000000AD142352C0 ../../../frameworks/core.framework/source/maxon/basearray.h (223) : 11 Memory leaks of 128 bytes (, first leak at 000000AD13FE4A40) ../../../frameworks/core.framework/source/maxon/basearray.h (223) : Memory leak of 600 bytes () at 000000AD7D6B0CC0 ../../../frameworks/core.framework/source/maxon/baseref.h (685) : Memory leak of 40 bytes () at 000000AD1834E500 ../../../frameworks/core.framework/source/maxon/baseref.h (685) : 261 Memory leaks of 48 bytes (, first leak at 000000AD13E10C40) ../../core.framework/source/maxon/basearray.h (223) : 3 Memory leaks of 32 bytes (, first leak at 000000AD1417C540) ../../core.framework/source/maxon/basearray.h (223) : 2 Memory leaks of 48 bytes (, first leak at 000000AD139BCF40) ../../core.framework/source/maxon/basearray.h (223) : Memory leak of 76 bytes () at 000000AD139BD9C0 ../source/guides/guideengine.h (72) : Memory leak of 24 bytes () at 000000AD140D8280 ../source/includes/scooby_engine.h (30) : Memory leak of 72 bytes () at 000000AD13C697C0 ../source/includes/scooby_morph_engine.h (243) : Memory leak of 32 bytes () at 000000AD140DD180 ../source/maxon/basearray.h (223) : 10 Memory leaks of 64 bytes (, first leak at 000000AD0BEB6C00) ../source/maxon/basearray.h (223) : 7 Memory leaks of 128 bytes (, first leak at 000000AD0F360600) ../source/maxon/baseref.h (685) : 5 Memory leaks of 48 bytes (, first leak at 000000AD0EEF91C0) ../source/maxon/baseref.h (687) : 2 Memory leaks of 48 bytes (, first leak at 000000AD139BDB40) ../source/objects/xrefsbase.h (1041) : Memory leak of 192 bytes () at 000000AD136FA800 p:\c4d_perforce_work\release\19.0\frameworks\kernel.framework\source\implementation\url_impl.cpp (107) : Memory leak of 40 bytes () at 000000AD1835E380 p:\c4d_perforce_work\release\19.0\frameworks\kernel.framework\source\implementation\xstring_impl.cpp (564) : 8 Memory leaks of 48 bytes (, first leak at 000000AD0BEB3840) p:\c4d_perforce_work\release\19.0\modules\alembic\source\alembicarchivehook.h (40) : Memory leak of 80 bytes () at 000000AD13C69580 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\bodypaint\bodypaint_scene_hook.h (45) : Memory leak of 88 bytes () at 000000AD113CB840 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\common\basedocument.cpp (780) : Memory leak of 56 bytes () at 000000AD139C5E80 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\common\baselist.cpp (1903) : 10 Memory leaks of 64 bytes (, first leak at 000000AD139BC940) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\common\baselist.cpp (1954) : Memory leak of 40 bytes () at 000000AD140D4700 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\common\baselist.cpp (3768) : Memory leak of 32 bytes () at 000000AD140D1700 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\common\variabletag.cpp (26) : 9 Memory leaks of 16 bytes (, first leak at 000000AD140D9400) The thread 0x4b04 has exited with code 0 (0x0). p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\common\variabletag.cpp (163) : 12 Memory leaks of 16 bytes (, first leak at 000000AD140D9500) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\common\variabletag.cpp (252) : Memory leak of 192 bytes () at 000000AD136FA080 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\common\variabletag.cpp (252) : 6 Memory leaks of 384 bytes (, first leak at 000000AD13F34980) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\common\variabletag.cpp (252) : 6 Memory leaks of 768 bytes (, first leak at 000000AD7E770280) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\common\variabletag.cpp (252) : 6 Memory leaks of 1152 bytes (, first leak at 000000AD138EC840) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\ge_register.cpp (66) : 11 Memory leaks of 2208 bytes (, first leak at 000000AD14312B80) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\ge_register.cpp (76) : 7 Memory leaks of 3768 bytes (, first leak at 000000AD13D0E2C0) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\ge_register.cpp (88) : 18 Memory leaks of 896 bytes (, first leak at 000000AD142F5500) The thread 0x254c has exited with code 0 (0x0). p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\ge_register.cpp (91) : 45 Memory leaks of 888 bytes (, first leak at 000000AD142F6D00) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\ge_register.cpp (95) : 7 Memory leaks of 920 bytes (, first leak at 000000AD142F1100) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\ge_register.cpp (97) : 7 Memory leaks of 920 bytes (, first leak at 000000AD142F1500) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\ge_register.cpp (98) : 7 Memory leaks of 912 bytes (, first leak at 000000AD142F1900) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\ge_register.cpp (108) : 7 Memory leaks of 1272 bytes (, first leak at 000000AD14151BC0) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\ge_register.cpp (205) : 4 Memory leaks of 7136 bytes (, first leak at 000000AD0C728880) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\ge_register.cpp (206) : Memory leak of 1240 bytes () at 000000AD141431C0 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\christian\ge_register.cpp (207) : Memory leak of 1048 bytes () at 000000AD138E8C40 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\newanimation\ckey.cpp (1507) : Memory leak of 224 bytes () at 000000AD136FAE40 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\objects\cameraobject.h (137) : 4 Memory leaks of 928 bytes (, first leak at 000000AD142E3100) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\objects\cameraobject.h (228) : Memory leak of 72 bytes () at 000000AD113CB6C0 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\objects\pointobject.cpp (323) : Memory leak of 192 bytes () at 000000AD136F9F40 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\objects\polygonobject.cpp (599) : Memory leak of 96 bytes () at 000000AD139B9280 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\objects\polygonobject.cpp (13543) : 7 Memory leaks of 16 bytes (, first leak at 000000AD140D8800) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\pluginsystem\operatingsystem.cpp (1262) : 26 Memory leaks of 128 bytes (, first leak at 000000AD13FE3340) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\pluginsystem\operatingsystem.cpp (1303) : 2 Memory leaks of 64 bytes (, first leak at 000000AD13C6A600) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\pluginsystem\operatingsystem.cpp (3602) : 20 Memory leaks of 240 bytes (, first leak at 000000AD10BBC400) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\pluginsystem\operatingsystem.cpp (6314) : Memory leak of 6448 bytes () at 000000AD0C734700 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\pluginsystem\operatingsystem.cpp (7869) : 73 Memory leaks of 32 bytes (, first leak at 000000AD1417C840) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\pluginsystem\operatingsystem.cpp (8267) : 9 Memory leaks of 48 bytes (, first leak at 000000AD0BEB4E00) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\pluginsystem\pluginlayer.cpp (414) : 16 Memory leaks of 32 bytes (, first leak at 000000AD140D2C00) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\philip\pluginsystem\pluginlayer.cpp (636) : 65 Memory leaks of 32 bytes (, first leak at 000000AD140D5280) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_container.cpp (343) : 65 Memory leaks of 24 bytes (, first leak at 000000AD18365C00) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_container.cpp (351) : 14 Memory leaks of 24 bytes (, first leak at 000000AD18359A80) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_container.cpp (359) : 16 Memory leaks of 32 bytes (, first leak at 000000AD1834DC00) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_container.cpp (367) : 3 Memory leaks of 48 bytes (, first leak at 000000AD139C1680) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_container.cpp (379) : 2 Memory leaks of 16 bytes (, first leak at 000000AD18366B00) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_container.cpp (393) : 10 Memory leaks of 16 bytes (, first leak at 000000AD18367280) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_container.cpp (536) : Memory leak of 24 bytes () at 000000AD140E6F00 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_container.cpp (545) : Memory leak of 24 bytes () at 000000AD140E9280 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_container.cpp (571) : Memory leak of 16 bytes () at 000000AD140D3880 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_container.cpp (587) : 4 Memory leaks of 16 bytes (, first leak at 000000AD140D4480) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_cp2d.cpp (192) : 21 Memory leaks of 240 bytes (, first leak at 000000AD10BBD180) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_cp2d.cpp (791) : 45 Memory leaks of 24 bytes (, first leak at 000000AD140DD100) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_memory.cpp (187) : 2 Memory leaks of 7848 bytes (, first leak at 000000AD0C730780) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_smart_link.cpp (349) : 11 Memory leaks of 72 bytes (, first leak at 000000AD139B8B00) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_smart_link.cpp (465) : 3 Memory leaks of 40 bytes (, first leak at 000000AD140DAA80) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_smart_link.cpp (584) : Memory leak of 72 bytes () at 000000AD139BE980 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\genesis\ge_smart_link.cpp (602) : 5 Memory leaks of 40 bytes (, first leak at 000000AD140D2000) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\nanograph\ng_bitmap.cpp (1013) : 21 Memory leaks of 160 bytes (, first leak at 000000AD13FE6340) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\nanograph\ng_draw.cpp (86) : 21 Memory leaks of 64 bytes (, first leak at 000000AD0FA1F240) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\nanograph\ng_rgn.cpp (48) : 21 Memory leaks of 40 bytes (, first leak at 000000AD05AAD780) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src\richard\nanograph\ng_stdlib.cpp (42) : 21 Memory leaks of 16 bytes (, first leak at 000000AD1417A040) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (523) : 14 Memory leaks of 56 bytes (, first leak at 000000AD140C3EC0) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (782) : 27 Memory leaks of 56 bytes (, first leak at 000000AD140BE580) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (820) : 243 Memory leaks of 56 bytes (, first leak at 000000AD0C67EE80) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (853) : 14 Memory leaks of 56 bytes (, first leak at 000000AD13E15680) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (889) : 171 Memory leaks of 56 bytes (, first leak at 000000AD13E041C0) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (2036) : 647 Memory leaks of 24 bytes (, first leak at 000000AD18363E00) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (2368) : 10 Memory leaks of 56 bytes (, first leak at 000000AD139B8500) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (2428) : 58 Memory leaks of 32 bytes (, first leak at 000000AD18354680) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (2470) : 871 Memory leaks of 32 bytes (, first leak at 000000AD13F62980) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (2779) : 10 Memory leaks of 56 bytes (, first leak at 000000AD0C67BE80) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (2824) : 31 Memory leaks of 56 bytes (, first leak at 000000AD139C4BC0) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (3071) : 32 Memory leaks of 56 bytes (, first leak at 000000AD13E0D4C0) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (3106) : 208 Memory leaks of 56 bytes (, first leak at 000000AD0C67C300) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (3141) : 18 Memory leaks of 56 bytes (, first leak at 000000AD140C0A40) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\btree_container.cpp (3177) : 110 Memory leaks of 56 bytes (, first leak at 000000AD140C0E00) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\glsl\gl_string.cpp (120) : 2 Memory leaks of 105 bytes (, first leak at 000000AD13FE2640) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\glsl\gl_string.cpp (120) : 2 Memory leaks of 106 bytes (, first leak at 000000AD13FE2D40) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\glsl\gl_string.cpp (120) : Memory leak of 107 bytes () at 000000AD13FE2940 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\glsl\gl_string.cpp (120) : 3 Memory leaks of 108 bytes (, first leak at 000000AD13FE2740) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\glsl\gl_string.cpp (120) : Memory leak of 110 bytes () at 000000AD13FE2540 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\glsl\gl_string.cpp (120) : Memory leak of 122 bytes () at 000000AD13FE2C40 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\glsl\gl_string.cpp (120) : Memory leak of 126 bytes () at 000000AD13FE2840 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src homas\glsl\gl_string.cpp (120) : Memory leak of 129 bytes () at 000000AD13FE1F40 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src ilo\c4d_alias.cpp (351) : 2 Memory leaks of 64 bytes (, first leak at 000000AD139BEB00) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src ilo\c4d_alias.cpp (368) : 15 Memory leaks of 32 bytes (, first leak at 000000AD1834DF80) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src ilo\gui\int_customgui_unitscale.cpp (232) : Memory leak of 16 bytes () at 000000AD1835DC80 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\src ilo\lcms\c4d_lcms.cpp (404) : Memory leak of 16 bytes () at 000000AD1835E180 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\win\system\ge_win_drawport.cpp (72) : 21 Memory leaks of 192 bytes (, first leak at 000000AD136FB480) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\win\system\ge_win_drawport.cpp (73) : Memory leak of 192 bytes () at 000000AD136FA300 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\win\system\ge_win_drawport.cpp (285) : 20 Memory leaks of 44 bytes (, first leak at 000000AD0FA20B00) p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\win\system\ge_win_drawport.cpp (285) : Memory leak of 1960 bytes () at 000000AD134EC400 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\win\system\ge_win_drawport.cpp (285) : Memory leak of 451540 bytes () at 000000AD1BAB7300 p:\c4d_perforce_work\release\19.0\modules\c4dplugin\source\win\system\ge_win_ng_font.cpp (392) : Memory leak of 176 bytes () at 000000AD136FB200 p:\c4d_perforce_work\release\19.0\modules\ca\source\interface\cgui_itemtree.cpp (390) : 2 Memory leaks of 216 bytes (, first leak at 000000AD136FB0C0) p:\c4d_perforce_work\release\19.0\modules\ca\source\interface\cgui_spreadsheet.cpp (250) : Memory leak of 352 bytes () at 000000AD1BEDCF40 p:\c4d_perforce_work\release\19.0\modules\ca\source\interface\hooks.h (178) : Memory leak of 520 bytes () at 000000AD14235040 p:\c4d_perforce_work\release\19.0\modules\dynamics\source\world_object.cpp (3865) : Memory leak of 368 bytes () at 000000AD13F32580 p:\c4d_perforce_work\release\19.0\modules\exchanges\source\archicad_exchange.cpp (408) : Memory leak of 16 bytes () at 000000AD140DCA80 p:\c4d_perforce_work\release\19.0\modules\exchanges\source\updatemerge_main.h (48) : Memory leak of 208 bytes () at 000000AD136FA440 p:\c4d_perforce_work\release\19.0\modules\gpurenderer\source\main.cpp (36) : Memory leak of 16 bytes () at 000000AD140D4000 p:\c4d_perforce_work\release\19.0\modules\hair\source\interface\objects.h (532) : Memory leak of 72 bytes () at 000000AD0BEB48C0 p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (962) : Memory leak of 16 bytes () at 000000AD18364000 p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : Memory leak of 4 bytes () at 000000AD019DD300 p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : 2 Memory leaks of 8 bytes (, first leak at 000000AD019DD800) p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : 2 Memory leaks of 12 bytes (, first leak at 000000AD019DD780) p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : 4 Memory leaks of 24 bytes (, first leak at 000000AD019DD380) p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : Memory leak of 36 bytes () at 000000AD019DD680 p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : 2 Memory leaks of 40 bytes (, first leak at 000000AD019DD700) p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : Memory leak of 50 bytes () at 000000AD01A76B80 p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : Memory leak of 56 bytes () at 000000AD01A76D00 p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : 2 Memory leaks of 72 bytes (, first leak at 000000AD01A76C40) p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : Memory leak of 112 bytes () at 000000AD01A90B80 p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : Memory leak of 136 bytes () at 000000AD01A90C80 p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : Memory leak of 3736 bytes () at 000000AD7E1732C0 p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1747) : Memory leak of 8192 bytes () at 000000AD7DDECF00 p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1818) : Memory leak of 48 bytes () at 000000AD01A76A00 p:\c4d_perforce_work\release\19.0\modules\image.module\source\gfx_image_colorprofile_impl.cpp (1820) : Memory leak of 16 bytes () at 000000AD019DD280 p:\c4d_perforce_work\release\19.0\modules\metrics\source\metrics.cpp (225) : Memory leak of 16 bytes () at 000000AD140D3180 p:\c4d_perforce_work\release\19.0\modules\mkmodeler\source\meshobjectscenehook.h (31) : Memory leak of 16 bytes () at 000000AD1417C0C0 p:\c4d_perforce_work\release\19.0\modules\model\source\doodle\doodle_hook.h (107) : Memory leak of 48 bytes () at 000000AD0BEB75C0 p:\c4d_perforce_work\release\19.0\modules\model\source\doodle\doodle_hook.h (142) : Memory leak of 56 bytes () at 000000AD0BEB7500 p:\c4d_perforce_work\release\19.0\modules\model\source\general\checkmesh.h (91) : Memory leak of 488 bytes () at 000000AD14234DC0 p:\c4d_perforce_work\release\19.0\modules\model\source\general\modelingobjectshook.h (37) : Memory leak of 48 bytes () at 000000AD0BEB4380 p:\c4d_perforce_work\release\19.0\modules\model\source\gui\stereo.h (41) : Memory leak of 80 bytes () at 000000AD0BEB7980 p:\c4d_perforce_work\release\19.0\modules\model\source\gui\viewporthud.cpp (10383) : 20 Memory leaks of 1048 bytes (, first leak at 000000AD138F3140) p:\c4d_perforce_work\release\19.0\modules\model\source\guides\workplane.h (18) : Memory leak of 40 bytes () at 000000AD1417C3C0 p:\c4d_perforce_work\release\19.0\modules\model\source\selection\measuretool.h (199) : Memory leak of 160 bytes () at 000000AD13FE6C40 p:\c4d_perforce_work\release\19.0\modules\model\source\snap\isnap_core.h (372) : 2 Memory leaks of 320 bytes (, first leak at 000000AD7DDD5CC0) p:\c4d_perforce_work\release\19.0\modules\model\source\snap\snap_scenehook.cpp (1917) : Memory leak of 16 bytes () at 000000AD1417C440 p:\c4d_perforce_work\release\19.0\modules\model\source\snap\snap_scenehook.h (433) : Memory leak of 904 bytes () at 000000AD142F5100 p:\c4d_perforce_work\release\19.0\modules\model\source ools\knifetools.h (139) : Memory leak of 424 bytes () at 000000AD13F3CD80 p:\c4d_perforce_work\release\19.0\modules\model\source ools\knifetools.h (210) : Memory leak of 48 bytes () at 000000AD0BEB4A40 p:\c4d_perforce_work\release\19.0\modules\model\source ools\knifetools.h (278) : Memory leak of 128 bytes () at 000000AD13FE5140 p:\c4d_perforce_work\release\19.0\modules\model\source ools\knifetools.h (395) : Memory leak of 80 bytes () at 000000AD0BEB4BC0 p:\c4d_perforce_work\release\19.0\modules\model\source ools\polypen.h (991) : Memory leak of 136 bytes () at 000000AD13FE5040 p:\c4d_perforce_work\release\19.0\modules\model\source\viewscenehook.h (118) : Memory leak of 616 bytes () at 000000AD12B97940 p:\c4d_perforce_work\release\19.0\modules\model\source\viewscenehook.h (221) : Memory leak of 648 bytes () at 000000AD12B97C40 p:\c4d_perforce_work\release\19.0\modules\mograph\source\message\mograph_scenehook.h (22) : Memory leak of 56 bytes () at 000000AD0BEB5940 p:\c4d_perforce_work\release\19.0\modules\mograph\source\shader\mgcamera_shader.cpp (60) : Memory leak of 72 bytes () at 000000AD0BEB5AC0 p:\c4d_perforce_work\release\19.0\modules\motiontracker\source\cameramapper\cmscenehook.h (48) : Memory leak of 16 bytes () at 000000AD140DD080 p:\c4d_perforce_work\release\19.0\modules\motiontracker\source\object\phscenehook.h (71) : Memory leak of 24 bytes () at 000000AD140DD300 p:\c4d_perforce_work\release\19.0\modules\newman\source\anim\schrubb.h (32) : Memory leak of 112 bytes () at 000000AD13FE3640 p:\c4d_perforce_work\release\19.0\modules\newman\source\cathleen\c4d_timeline.cpp (1519) : Memory leak of 32 bytes () at 000000AD140E4180 p:\c4d_perforce_work\release\19.0\modules\newman\source\cathleen\c4d_tl_dialog.h (85) : 4 Memory leaks of 336 bytes (, first leak at 000000AD7DDD7E00) p:\c4d_perforce_work\release\19.0\modules\newman\source\christian\cl_baum.h (42) : 4 Memory leaks of 168 bytes (, first leak at 000000AD13FE4640) p:\c4d_perforce_work\release\19.0\modules\newman\source\commands\combineac18\combineac18_scenehook.cpp (93) : Memory leak of 48 bytes () at 000000AD13C68EC0 p:\c4d_perforce_work\release\19.0\modules\newman\source\common\c4d_todolist.cpp (53) : Memory leak of 16 bytes () at 000000AD140D2A00 p:\c4d_perforce_work\release\19.0\modules\newman\source\common\c4d_todolist.cpp (536) : 2 Memory leaks of 16 bytes (, first leak at 000000AD140E4780) p:\c4d_perforce_work\release\19.0\modules\newman\source\common\settings.cpp (234) : 12 Memory leaks of 104 bytes (, first leak at 000000AD0BEB3180) p:\c4d_perforce_work\release\19.0\modules\newman\source\common\settings.h (74) : 8 Memory leaks of 24 bytes (, first leak at 000000AD140D2580) p:\c4d_perforce_work\release\19.0\modules\newman\source\common\settings.h (131) : Memory leak of 24 bytes () at 000000AD140D1180 p:\c4d_perforce_work\release\19.0\modules\newman\source\common\settings.h (165) : Memory leak of 136 bytes () at 000000AD13FE3740 p:\c4d_perforce_work\release\19.0\modules\newman\source\powerslider\powerkeyhelper.h (223) : Memory leak of 272 bytes () at 000000AD10BBB500 p:\c4d_perforce_work\release\19.0\modules\newman\source\powerslider\powerkeyhelper.h (311) : Memory leak of 48 bytes () at 000000AD13C6BC80 p:\c4d_perforce_work\release\19.0\modules\newman\source\rendermanager\c4d_rm_main.h (59) : Memory leak of 16 bytes () at 000000AD140D3080 p:\c4d_perforce_work\release\19.0\modules\newman\source akesystem\basetake.h (110) : 7 Memory leaks of 16 bytes (, first leak at 000000AD140D3200) p:\c4d_perforce_work\release\19.0\modules\newman\source akesystem\basetake.h (386) : Memory leak of 112 bytes () at 000000AD13FE3240 p:\c4d_perforce_work\release\19.0\modules\newman\source akesystem akehook.cpp (180) : Memory leak of 72 bytes () at 000000AD13C6ACC0 p:\c4d_perforce_work\release\19.0\modules\newman\source akesystem akehook.h (286) : Memory leak of 664 bytes () at 000000AD12B97640 p:\c4d_perforce_work\release\19.0\modules\objects\source\annotations\annotationhook.h (95) : Memory leak of 312 bytes () at 000000AD1BEDCD80 p:\c4d_perforce_work\release\19.0\modules\objects\source\misc\lodobject.h (68) : Memory leak of 80 bytes () at 000000AD113CB300 p:\c4d_perforce_work\release\19.0\modules\objects\source\sniper\sn_sniper_hook.cpp (64) : Memory leak of 16 bytes () at 000000AD1417CCC0 p:\c4d_perforce_work\release\19.0\modules\sculpt\source\brushmodifierscenehook.cpp (19) : Memory leak of 24 bytes () at 000000AD140D3F80 p:\c4d_perforce_work\release\19.0\modules\sculpt\source\sculptundoredo.cpp (918) : Memory leak of 56 bytes () at 000000AD0BEB4680 p:\c4d_perforce_work\release\19.0\modules\sculpt\source\sculptundoredo.cpp (924) : Memory leak of 64 bytes () at 000000AD0BEB5D00 p:\c4d_perforce_work\release\19.0\modules\sketch\source\scenehook.cpp (23) : Memory leak of 384 bytes () at 000000AD13F2D180 p:\c4d_perforce_work\release\19.0\modules\sketch\source\scenehook.cpp (142) : Memory leak of 24 bytes () at 000000AD140DCB00 p:\c4d_perforce_work\release\19.0\modules\sketch\source\scenehook.cpp (147) : Memory leak of 24 bytes () at 000000AD140DC900 p:\c4d_perforce_work\release\19.0\modules\sla\source\wavescenehook.h (14) : Memory leak of 80 bytes () at 000000AD13C69B80 p:\c4d_perforce_work\release\19.0\modules\substance\source\substanceasset.cpp (2530) : Memory leak of 128 bytes () at 000000AD13FE1E40 p:\c4d_perforce_work\release\19.0\modules hinking particles\source p_mastersystemdata.cpp (61) : Memory leak of 368 bytes () at 000000AD13F32380 p:\c4d_perforce_work\release\19.0\modules hinking particles\source p_particlegroupdata.cpp (14) : Memory leak of 112 bytes () at 000000AD13FE2F40 p:\c4d_perforce_work\release\19.0\modules\walkthrough\source\collisiontoolplugin.h (214) : Memory leak of 16 bytes () at 000000AD140DAC80 p:\c4d_perforce_work\release\19.0\modules\xpressocore\source\graphview\gv_world.cpp (1209) : Memory leak of 112 bytes () at 000000AD13FE6D40 p:\c4d_perforce_work\release\19.0\modules\xtensions\source\customgui\int_customgui_gradient.cpp (249) : Memory leak of 88 bytes () at 000000AD113CC200 p:\c4d_perforce_work\release\19.0\modules\xtensions\source\customgui\int_customgui_inexcludelist.cpp (2065) : 2 Memory leaks of 24 bytes (, first leak at 000000AD140D3380) p:\c4d_perforce_work\release\19.0\modules\xtensions\source\customgui\splinecontrol\splinedata.cpp (19) : 4 Memory leaks of 184 bytes (, first leak at 000000AD136EC700) p:\c4d_perforce_work\release\19.0\modules\xtensions\source\customgui\splinecontrol\splinedata.cpp (150) : 3 Memory leaks of 176 bytes (, first leak at 000000AD136FA1C0) p:\c4d_perforce_work\release\19.0\modules\xtensions\source\customgui\splinecontrol\splinedata.cpp (150) : Memory leak of 264 bytes () at 000000AD10BBB380 202 blocks not freed
Following is the whole plugin.
I have been able to find out that the LoadDocument function seems to be the culprit.
Obvious, you would say, as the function returns a pointer, which never gets freed.
However, when I try to free the pointer this results in a crash.The documentation is not clear if the returned pointer is owned by Cinema or not. Apparently, since freeing the pointer does crash Cinema I would expect I am not the owner.
But then, why all these memory leaks ???// Memory leaks as result of LoadDocument #include "c4d.h" #define PLUGIN_ID 1999999 // Dummy ID // CommandData class MyCommand : public CommandData { INSTANCEOF(MyCommand, CommandData) public: virtual Bool Execute(BaseDocument* doc); virtual Int32 GetState(BaseDocument* doc); BaseDocument* tempDoc; }; Bool MyCommand::Execute(BaseDocument* doc) { Filename filename = GeGetPluginPath() + Filename("sample.c4d"); // sample doc is an empty scene file tempDoc = LoadDocument(filename, SCENEFILTER_OBJECTS | SCENEFILTER_MATERIALS, nullptr); if (!tempDoc) return FALSE; MessageDialog("Document Loaded!"); return TRUE; } Int32 MyCommand::GetState(BaseDocument* doc) { return CMD_ENABLED; } Bool RegisterMyCommand(void) { return RegisterCommandPlugin(PLUGIN_ID, "MyCommand", 0, AutoBitmap("icon.png"), "MyCommand", NewObjClear(MyCommand)); } 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; }
For testing purposes, the plugin simply loads a document named "sample.c4d" from the plugin folder, and displays a messagebox "Document loaded" on success.
If I then close the application and return to Visual Studio the output log shows the whole list of memory leaks ... which I don't get (obviously) when I don't execute the plugin.
The "sample.c4d" is a new scene file containing a cube primitive, made editable. Also tried an empty scene file as sample, no difference.Have experienced the same memory leaks with R17, R18
I still don't get what I am doing wrong.
I have tried an AutoFree, AutoAlloc, or simply freeing the pointer in the destructor of the class (if not nullptr).
I am missing something, but cannot put my finger on it. -
On 10/09/2017 at 22:12, xxxxxxxx wrote:
You need to free the document as soon as you don't need it anymore:
BaseDocument::Free(tempDoc); -
On 10/09/2017 at 23:19, xxxxxxxx wrote:
Originally posted by xxxxxxxx
You need to free the document as soon as you don't need it anymore:
BaseDocument::Free(tempDoc);Thanks for the reply, but I guess you missed this in my original question:
Obvious, you would say, as the function returns a pointer, which never gets freed.
However, when I try to free the pointer this results in a crash.The documentation is not clear if the returned pointer is owned by Cinema or not. Apparently, since freeing the pointer does crash Cinema I would expect I am not the owner.
-
On 10/09/2017 at 23:58, xxxxxxxx wrote:
you are the owner of the pointer as long as you don't insert it in the document list. So freeing should not crash unless you do something else with the doc
-
On 11/09/2017 at 02:06, xxxxxxxx wrote:
Hi,
affa is right (and you assumed correctly), you are the owner of the document returned by LoadDocument(). Freeing the BaseDocumennt in the destructor is probably too late. The correct place to do this would be in PluginMessage() on message C4DPL_ENDACTIVITY. See also the manual on Plugin Functions.
Probably also a good read on this topic is the BaseDocument manual.
Please also note, that there is only one instance of the command plugin, so you have to make sure, not to introduce another memory leak, if the command is called twice by overwriting your tempDoc pointer.
Edit: Added link to BaseDocument manual.
-
On 11/09/2017 at 10:22, xxxxxxxx wrote:
Thank you both !!!
With the given explanation I now understand why the freeing did crash Cinema, and why the memory leak happened when I didn't.
I now also get a better understanding why destructor is too late to clean up things.