Solved First R21 plugin ... memory leaks and dangling references

Up to now I was developing my plugins on a Windows 8.1 machine, since R21 requires windows 10 I have now purchased a completely new machine, installed Windows 10 pro, Visual Studio Express 2017 and Cinema 4D R21. Next I have installed the SDK and the project tools.
I then went on writing my first R21 plugin. The only thing it does is display the word "Test" into the R21 console window ... we all need to start somewhere 😉

// ========================
// Cinema 4D C++ plugin
//
// PluginName: Test
// Dummy "empty" plugin
// ========================

#include "c4d.h"

// ====================================
// Plugin Main 
// ====================================
Bool PluginStart(void)
{
	ApplicationOutput("Test"_s);
	return TRUE;
}
void PluginEnd(void)
{
}
Bool PluginMessage(Int32 id, void * data)
{
	switch (id) {
	case C4DPL_INIT_SYS:
		if (!g_resource.Init())
			return FALSE;
		return TRUE;
	case C4DMSG_PRIORITY:
		return TRUE;
	case C4DPL_BUILDMENU:
		break;
	case C4DPL_ENDACTIVITY:
		return TRUE;
	}
	return FALSE;
}

So, I build the plugin, which copies the necessary files to my user's plugins folder of Cinema 4D and start the debugger, which starts Cinema 4D.
The "Test" is displayed into the console, all fine!
Then I close Cinema 4D and Visual Studio then reports:

Memory Leaks Detected:
../../../frameworks/core.framework/source/maxon/basearray.h (140): 8 Memory leaks of 128 bytes (, first leak at 000001C437C6E2C0)
../../../frameworks/core.framework/source/maxon/basearray.h (223): 4 Memory leaks of 40 bytes (, first leak at 000001C43B8CDEC0)
../../../frameworks/core.framework/source/maxon/basearray.h (223): 8 Memory leaks of 128 bytes (, first leak at 000001C437C6CCC0)
../../../frameworks/core.framework/source/maxon/defaultallocator.h (404): Memory leak of 48 bytes () at 000001C43C7E6E00
../../../frameworks/core.framework/source/maxon/hashmap.h (1179): Memory leak of 200 bytes () at 000001C439A22EC0
../../../frameworks/core.framework/source/maxon/hashmap.h (2323): 2 Memory leaks of 1024 bytes (, first leak at 000001C43C7D8380)
../../../frameworks/core.framework/source/maxon/hashmap.h (2331): 2 Memory leaks of 512 bytes (, first leak at 000001C43B9DBA00)
../../../frameworks/image.framework/source/maxon/gfx_image_pixelformat.h (223): Memory leak of 80 bytes () at 000001C43C7EB9C0
../../core.framework/source/maxon/basearray.h (140): 17 Memory leaks of 640 bytes (, first leak at 000001C437B51000)
../../core.framework/source/maxon/basearray.h (223): 14 Memory leaks of 16 bytes (, first leak at 000001C437F190C0)
../../core.framework/source/maxon/basearray.h (223): 7 Memory leaks of 24 bytes (, first leak at 000001C437F1A540)
../../core.framework/source/maxon/basearray.h (223): 3 Memory leaks of 32 bytes (, first leak at 000001C437D92BC0)
../../core.framework/source/maxon/basearray.h (223): Memory leak of 64 bytes () at 000001C439992F00
../../core.framework/source/maxon/basearray.h (223): Memory leak of 80 bytes () at 000001C435E87780
../../core.framework/source/maxon/basearray.h (223): 2 Memory leaks of 112 bytes (, first leak at 000001C437C66EC0)
../../core.framework/source/maxon/basearray.h (223): 18 Memory leaks of 128 bytes (, first leak at 000001C4398FB8C0)
../../core.framework/source/maxon/basearray.h (223): Memory leak of 144 bytes () at 000001C4398FA7C0
../../core.framework/source/maxon/basearray.h (223): 4 Memory leaks of 160 bytes (, first leak at 000001C437C6ABC0)
../../core.framework/source/maxon/basearray.h (223): 4 Memory leaks of 192 bytes (, first leak at 000001C435B2EA80)
../../core.framework/source/maxon/basearray.h (223): Memory leak of 208 bytes () at 000001C43814E700
../../core.framework/source/maxon/basearray.h (223): 5 Memory leaks of 224 bytes (, first leak at 000001C435B2F980)
../../core.framework/source/maxon/basearray.h (223): 2 Memory leaks of 232 bytes (, first leak at 000001C435B2F840)
../../core.framework/source/maxon/basearray.h (223): 2 Memory leaks of 240 bytes (, first leak at 000001C437541440)
../../core.framework/source/maxon/basearray.h (223): 2 Memory leaks of 408 bytes (, first leak at 000001C4395396C0)
../../core.framework/source/maxon/basearray.h (223): Memory leak of 536 bytes () at 000001C439807100
../source/maxon/baseref.h (778): 17 Memory leaks of 24 bytes (, first leak at 000001C437F25DC0)
r:\c4d_perforce_work\release\21.0\frameworks\core.framework\source\maxon\utilities\apibaseid.cpp (19): Memory leak of 39 bytes () at 000001C437BAC640
r:\c4d_perforce_work\release\21.0\frameworks\core.framework\source\maxon\utilities\apibaseid.cpp (19): Memory leak of 40 bytes () at 000001C437BAC340
r:\c4d_perforce_work\release\21.0\frameworks\core.framework\source\maxon\utilities\apibaseid.cpp (19): Memory leak of 41 bytes () at 000001C437C36040
r:\c4d_perforce_work\release\21.0\frameworks\core.framework\source\maxon\utilities\apibaseid.cpp (19): Memory leak of 45 bytes () at 000001C437C35140
r:\c4d_perforce_work\release\21.0\frameworks\core.framework\source\maxon\utilities\apibaseid.cpp (19): Memory leak of 47 bytes () at 000001C437C36340
r:\c4d_perforce_work\release\21.0\frameworks\core.framework\source\maxon\utilities\apibaseid.cpp (19): 2 Memory leaks of 51 bytes (, first leak at 000001C4395D8C40)
r:\c4d_perforce_work\release\21.0\frameworks\core.framework\source\maxon\utilities\apibaseid.cpp (19): Memory leak of 60 bytes () at 000001C4395D9240
r:\c4d_perforce_work\release\21.0\frameworks\core.framework\source\maxon\utilities\apibaseid.cpp (19): Memory leak of 66 bytes () at 000001C435E86940
r:\c4d_perforce_work\release\21.0\frameworks\core.framework\source\maxon\utilities\apibaseid.cpp (19): Memory leak of 82 bytes () at 000001C4399980C0
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\datatypelib_impl.cpp (178): 7 Memory leaks of 40 bytes (, first leak at 000001C437BAC3C0)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\datatypelib_impl.cpp (178): Memory leak of 48 bytes () at 000001C437C361C0
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\datatypelib_impl.cpp (178): 2 Memory leaks of 56 bytes (, first leak at 000001C439998240)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\datatypelib_impl.cpp (221): 10 Memory leaks of 272 bytes (, first leak at 000001C435945700)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (485): Memory leak of 8080 bytes () at 000001C435E46680
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (485): 12 Memory leaks of 12632 bytes (, first leak at 000001C437E6E600)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (485): 4 Memory leaks of 31112 bytes (, first leak at 000001C4399D6000)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1528): 21 Memory leaks of 80 bytes (SuperMTable, first leak at 000001C437F85340)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1528): 3 Memory leaks of 96 bytes (SuperMTable, first leak at 000001C437F7B500)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1528): 2 Memory leaks of 112 bytes (SuperMTable, first leak at 000001C437C70AC0)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1528): 3 Memory leaks of 144 bytes (SuperMTable, first leak at 000001C437C69BC0)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1528): 2 Memory leaks of 192 bytes (SuperMTable, first leak at 000001C43814E340)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1528): Memory leak of 224 bytes (SuperMTable) at 000001C435B12EC0
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1528): Memory leak of 288 bytes (SuperMTable) at 000001C43949DBC0
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1528): Memory leak of 304 bytes (SuperMTable) at 000001C4374EFEC0
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1528): 9 Memory leaks of 400 bytes (SuperMTable, first leak at 000001C437B61FC0)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1528): Memory leak of 416 bytes (SuperMTable) at 000001C437B5B1C0
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1528): Memory leak of 688 bytes (SuperMTable) at 000001C4359D9D80
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1867): 4 Memory leaks of 16 bytes (net.maxon.image.colorspace.rgb, first leak at 000001C437BAFDC0)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1867): 11 Memory leaks of 24 bytes (net.maxon.image.class.imagechannelPix8u, first leak at 000001C4379D9980)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1867): Memory leak of 56 bytes (net.maxon.drawport.class.openglwindowframebuffer) at 000001C457D91DC0
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1867): 3 Memory leaks of 72 bytes (net.maxon.class.observable, first leak at 000001C457D91D00)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1867): Memory leak of 120 bytes (net.maxon.drawport.class.openglwindowframebuffertargetset) at 000001C458C79440
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1867): 2 Memory leaks of 224 bytes (net.maxon.image.class.pixelformat.RGB.F16, first leak at 000001C435B309C0)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1867): 2 Memory leaks of 232 bytes (net.maxon.image.class.pixelformat.RGBA.F32, first leak at 000001C435B31A00)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1867): 5 Memory leaks of 400 bytes (net.maxon.drawport.class.openglcommandlistemulated, first leak at 000001C44230B5C0)
r:\c4d_perforce_work\release\21.0\frameworks\kernel.framework\source\implementation\object_impl.cpp (1867): Memory leak of 528 bytes (net.maxon.drawport.object.opengl) at 000001C45857BC80
62 blocks not freed

Dangling References Detected:
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGB.U8 at 000001C435B2FAC0 holds 5 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGB.U8 at 000001C435B2FAC0 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.rgbgroup at 000001C437F1B8C0 (offset 0xa8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u at 000001C437D9BFC0 (offset 0xc8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u at 000001C437D0BFC0 (offset 0xd0)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u at 000001C437BB12C0 (offset 0xd8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGB.F16 at 000001C435B309C0 holds 5 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGB.F16 at 000001C435B309C0 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.rgbgroup at 000001C437F1B8C0 (offset 0xa8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix16f at 000001C437D9EAC0 (offset 0xc8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix16f at 000001C437D19840 (offset 0xd0)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix16f at 000001C437BB53C0 (offset 0xd8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGBA.U8 at 000001C435B313C0 holds 6 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGBA.U8 at 000001C435B313C0 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.rgbagroup at 000001C437B972C0 (offset 0xa8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u at 000001C437D9BFC0 (offset 0xc8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u at 000001C437D0BFC0 (offset 0xd0)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u at 000001C437BB12C0 (offset 0xd8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u at 000001C4379D9980 (offset 0xe0)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGBA.F32 at 000001C435B31A00 holds 6 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGBA.F32 at 000001C435B31A00 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.rgbagroup at 000001C437B972C0 (offset 0xa8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f at 000001C437D9D2C0 (offset 0xc8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f at 000001C437D19A40 (offset 0xd0)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f at 000001C437BB4FC0 (offset 0xd8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f at 000001C4379E9B00 (offset 0xe0)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u	at 000001C4379D9980 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u at 000001C4379D9980 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f	at 000001C4379E9B00 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f at 000001C4379E9B00 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5B5C0 holds 3 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5B5C0 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.dynamicgroup at 000001C437D9FF40 (offset 0xa8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.colorspace.rgb at 000001C437BAFDC0 (offset 0x138)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5C3C0 holds 3 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5C3C0 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.dynamicgroup at 000001C437D9FF40 (offset 0xa8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.colorspace.rgb at 000001C437BAFDC0 (offset 0x138)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5C5C0 holds 3 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5C5C0 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.dynamicgroup at 000001C437D9FF40 (offset 0xa8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.colorspace.rgb at 000001C437BAFDC0 (offset 0x138)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5D3C0 holds 3 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5D3C0 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.dynamicgroup at 000001C437D9FF40 (offset 0xa8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.colorspace.rgb at 000001C437BAFDC0 (offset 0x138)
kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.rgbagroup	at 000001C437B972C0 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.rgbagroup at 000001C437B972C0 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.colorspace.rgb	at 000001C437BAFDC0 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.colorspace.rgb at 000001C437BAFDC0 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u	at 000001C437BB12C0 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u at 000001C437BB12C0 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f	at 000001C437BB4FC0 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f at 000001C437BB4FC0 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix16f	at 000001C437BB53C0 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix16f at 000001C437BB53C0 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u	at 000001C437D0BFC0 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u at 000001C437D0BFC0 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix16f	at 000001C437D19840 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix16f at 000001C437D19840 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f	at 000001C437D19A40 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f at 000001C437D19A40 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u	at 000001C437D9BFC0 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix8u at 000001C437D9BFC0 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f	at 000001C437D9D2C0 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix32f at 000001C437D9D2C0 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix16f	at 000001C437D9EAC0 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.imagechannelPix16f at 000001C437D9EAC0 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.dynamicgroup	at 000001C437D9FF40 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.dynamicgroup at 000001C437D9FF40 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.rgbgroup	at 000001C437F1B8C0 holds a reference to one object:
	kernel.framework\source\implementation\object_impl.cpp (1867): image.pixelformat.rgbgroup at 000001C437F1B8C0 (offset 0x8)
kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglcommandlistemulated at 000001C44230B5C0 holds 3 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.object.opengl at 000001C45857BC80 (offset 0x20)
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglwindowframebuffertargetset at 000001C458C79440 (offset 0x30)
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglcommandlistemulated at 000001C44230B5C0 (offset 0x180)
kernel.framework\source\implementation\object_impl.cpp (1867): class.observable at 000001C457D91B80 holds 2 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): class.observable at 000001C457D91B80 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.object.opengl at 000001C45857BC80 (offset 0x10)
kernel.framework\source\implementation\object_impl.cpp (1867): class.observable at 000001C457D91C40 holds 2 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): class.observable at 000001C457D91C40 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.object.opengl at 000001C45857BC80 (offset 0x10)
kernel.framework\source\implementation\object_impl.cpp (1867): class.observable at 000001C457D91D00 holds 2 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): class.observable at 000001C457D91D00 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.object.opengl at 000001C45857BC80 (offset 0x10)
kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglwindowframebuffer at 000001C457D91DC0 holds 2 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglwindowframebuffer at 000001C457D91DC0 (offset 0x20)
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglwindowframebuffertargetset at 000001C458C79440 (offset 0x28)
kernel.framework\source\implementation\object_impl.cpp (1867): drawport.object.opengl at 000001C45857BC80 holds 15 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.object.opengl at 000001C45857BC80 (offset 0x8)
	kernel.framework\source\implementation\object_impl.cpp (1867): class.observable at 000001C457D91B80 (offset 0x60)
	kernel.framework\source\implementation\object_impl.cpp (1867): class.observable at 000001C457D91C40 (offset 0x68)
	kernel.framework\source\implementation\object_impl.cpp (1867): class.observable at 000001C457D91D00 (offset 0x70)
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglcommandlistemulated at 000001C44230B5C0 (offset 0x150)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5B5C0 (offset 0x170)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5C5C0 (offset 0x178)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGB.U8 at 000001C435B2FAC0 (offset 0x180)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGBA.U8 at 000001C435B313C0 (offset 0x188)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5C3C0 (offset 0x1b0)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformatdynamic at 000001C437B5D3C0 (offset 0x1b8)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGB.F16 at 000001C435B309C0 (offset 0x1c0)
	kernel.framework\source\implementation\object_impl.cpp (1867): image.class.pixelformat.RGBA.F32 at 000001C435B31A00 (offset 0x1c8)
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglwindowframebuffer at 000001C457D91DC0 (offset 0x1f0)
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglwindowframebuffertargetset at 000001C458C79440 (offset 0x200)
kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglwindowframebuffertargetset at 000001C458C79440 holds 2 references to the following objects:
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglwindowframebuffer at 000001C457D91DC0 (offset 0x60)
	kernel.framework\source\implementation\object_impl.cpp (1867): drawport.class.openglwindowframebuffertargetset at 000001C458C79440 (offset 0x70)

This can't be right.

Hi Daniel, thanks for reaching out us.

I'm pretty surprised to see this sort of issue popping out since from our test we never encountered such case.
Can you confirm that:

  • you created a proper projectdefinition.txt and created IDE projects out of it?
  • can you confirm that no other plugins were loaded by Cinema when the leak occurred?
  • can you confirm that it happens with no plugins at all loaded?
  • can you provide you OS/IDE configuration?

Looking at the log I'm a bit surprised to see leaks in the kernel framework about OpenGL methods in the drawport. Is your machine provided with updated GPU drivers?

Sorry for the dumb questions, but this might help us to do some better differential analysis.

Cheers, Riccardo

I am surprised as well to see these issue, as I figure I wouldn't be the only one if this were genuine memory leaks. I can only assume something went wrong during my setup of the SDK.

I have started afresh and have extracted the R21 SDK on my D drive at
D:\Projects\Dev\SDK_R21
There a subfolder named "frameworks" has been created with the content of the SDK.zip

Also inside D:\Projects\Dev\SDK_R21 I have a "plugins" folder, which only contains the extracted "cinema4dsdk" folder (I removed maxonsdk.module and microsdk), and a "project" folder, which contains the solution projectdefinition.txt as follows

Platform=Win64;OSX
Type=Solution
Solution=\
	plugins/cinema4dsdk

I downloaded the projecttool (20190903) and extracted this into
D:\Projects\Dev\SDK_R21, which created a "cinema4d_r21_project_tool_20190903" folder.

In D:\Projects\Dev\SDK_R21 I created a bat file to execute the projecttool, as follows:

d:\Projects\dev\SDK_R21\cinema4d_r21_project_tool_20190903\kernel_app_64bit.exe g_updateproject=d:\Projects\dev\SDK_R21\plugins\project

I execute this batch file, which generates the plugins solution, which I double click, opening Visual Studio 2017.
I make cinema4dsdk the startup project, enter the Cinema4D executable into the project's debugging properties. Build all (debug, 64bit), start debugging, wait for Cinema 4D to launch, close cinema ... and get the list of memory leaks and dangling references.

As I didn't add a specific plugin folder to the build project, nor did I manually install any plugin, I can confirm there are no plugins available in the Extension menu of Cinema4D.

Windows 10, 64 bit, Professional Edition (build 18362)
4(8)x Intel Core i5-8259U CPU, CPU speed 2310.000
Visual Studio Express 2017 for Windows Desktop Version 15.9.15
Microsoft .NET Framework 4.8.03752

OK, so I went over it once more.
Step 1.
Deleted the whole SDK_R21 folder, and extracted the sdk.zip to
D:\Projects\Dev\SDK_R21

Step 2
Extracted the project tool

Step 3
created and executed a batch file to create the necessary project files for the frameworks

d:\Projects\dev\SDK_R21\cinema4d_r21_project_tool_20190903\kernel_app_64bit.exe g_updateproject=d:\Projects\dev\SDK_R21\frameworks

Step4
created and executed a batch file for the plugins

d:\Projects\dev\SDK_R21\cinema4d_r21_project_tool_20190903\kernel_app_64bit.exe g_updateproject=d:\Projects\dev\SDK_R21\plugins

Step 5
created and executed a batch file for the plugin solution

d:\Projects\dev\SDK_R21\cinema4d_r21_project_tool_20190903\kernel_app_64bit.exe g_updateproject=d:\Projects\dev\SDK_R21\plugins\project

(This batch file will be used when plugins are added, in order to update the plugins solution)

Step 6
Double click the created plugin.sln, which opens Visual Studio.

Step 7
Build the whole solution, which results in errors for every vcxproj, as it mentions that Windows SDK version 8.1 was not found. Since running on Windows 10 I retarget all the projects ... Visual Studio offers the available Windows SDK 10.0.17763.0
I do this for every framework and plugin in the solution.

Step 8
Rebuild whole solution -> no more build errors.

Step 9
I set the cinema4dsdk as startup project, add the Cinema4D executables as debugging property

Step 10
Launch debugger, wait for Cinema 4D to launch, open the console (Shift-F10), close Cinema 4D ...

Result: ALL GOOD, no memory leaks, no dangling references.
Pffewh! Now I am finally settled, ready to start.

I don't know what went wrong the first and second time, and I am not trying to figure out.

Spoke too soon !!!

The moment I add g_alloc=Debug as Command Arguments of the debugging properties to any of the plugins, I do get the same list of memory leaks and dangling references .

I remember that entry from the time working on R20 and previous releases ... is this not applicable for R21 anymore?

Additionally, every plugin I add to the solution requires me to retarget from Windows 8.1 SDK to the Windows 10 SDK, since the R8.1 isn't installed. Is this 8.1 SDK reference a default of the project tool?
Since Cinema only runs on Windows 10, and plugins thus should be using Windows 10 SDK, why this obsolete 8.1 ?

Hi Daniel,

thanks for the throughful description, but I'm not able to reproduce the leak.

The steps I used are:

  1. unzip the sdk.zip coming with Cinema 4D R21 installation (let say in D:\AppsRepository\MAXON\SDKs\21.022_RB288344_RC)
  2. unzip the projecttool (lets say in D:\AppsRepository\MAXON\ProjectTool\20190903_R21RC_projecttool)
  3. execute D:\AppsRepository\MAXON\ProjectTool\20190903_R21RC_projecttool\kernel_app_64bit.exe g_updateproject=D:\AppsRepository\MAXON\SDKs\21.022_RB288344_RC (this single string will create projects for frameworks, plugins and the whole solution file, it's not recommended to run it three separate times)
  4. open the solution with VS2017 and just build (I actually didn't changed the Windows SDK Version)ee2c9f40-210e-4cec-a619-1394c16523b3-image.png
  5. set the proper cmdline args as from below picture
    bd52b49f-5c1b-45e5-9deb-f77f2e859b69-image.png
  6. Press F5 in VS2017 to start debug
  7. Upon Cinema start, open the Console (Shift-F10)
  8. Quit Cinema

I didn't had the need to change anything in the solution settings, everything was built out-of-the-box as much as it's supposed to happen.
Could you please try to reproduce the issue with the steps above?

Thanks, Riccardo

Hi Riccardo,

I had installed Visual Studio 2017 Desktop Express, and wasn't able to add the Windows 8.1 SDK during installation due to limited settings being available. So, I uninstalled that one, and instead downloaded the Visual Studio 2017 Community Edition.

Reinstalled all, making sure the Windows 8.1 SDK option was enabled.
Removed the whole SDK folder and extracted once more, completely afresh. Same for the project tool.
I then launched the project tool with the command as you listed (once). Double clicked the solution, and built everything. Now with the Windows 8.1 SDK present I didn't have to retarget every project ... nice!

However, when pressingn F5:
Without the "g_alloc=debug" in the debugging options all runs fine, and after quiting Cinema4D no issues are listed. But, when I add the debugging option I still get the same list of memory leaks and dangling references.

Unfortunately, no progress.

Hi Daniel,

I've created your same setup in a Virtual Window 10 environment and I had no good luck in replicating this.
Can you share your GPU specs and drivers revision information? With this info I can have a look around to see if any of our QA or developers have experienced something similar.

Best, Riccardo

Here's a dump from DxDiag:

------------------
System Information
------------------
      Time of this report: 9/19/2019, 21:45:45
             Machine name: NUC
         Operating System: Windows 10 Pro 64-bit (10.0, Build 18362) (18362.19h1_release.190318-1202)
                 Language: English (Regional Setting: English)
      System Manufacturer: Intel(R) Client Systems
             System Model: NUC8i5BEH
                     BIOS: BECFL357.86A.0064.2019.0213.1122 (type: UEFI)
                Processor: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz (8 CPUs), ~2.3GHz
                   Memory: 32768MB RAM
      Available OS Memory: 32636MB RAM
                Page File: 2894MB used, 34606MB available
              Windows Dir: C:\Windows
          DirectX Version: DirectX 12
      DX Setup Parameters: Not found
         User DPI Setting: 96 DPI (100 percent)
       System DPI Setting: 96 DPI (100 percent)
          DWM DPI Scaling: Disabled
                 Miracast: Available, with HDCP
Microsoft Graphics Hybrid: Not Supported
 DirectX Database Version: Unknown
           DxDiag Version: 10.00.18362.0267 64bit Unicode

---------------
Display Devices
---------------
           Card name: Intel(R) Iris(R) Plus Graphics 655
        Manufacturer: Intel Corporation
           Chip type: Intel(R) Iris(R) Plus Graphics Family
            DAC type: Internal
         Device Type: Full Device (POST)
          Device Key: Enum\PCI\VEN_8086&DEV_3EA5&SUBSYS_20748086&REV_01
       Device Status: 0180200A [DN_DRIVER_LOADED|DN_STARTED|DN_DISABLEABLE|DN_NT_ENUMERATOR|DN_NT_DRIVER] 
 Device Problem Code: No Problem
 Driver Problem Code: Unknown
      Display Memory: 16446 MB
    Dedicated Memory: 128 MB
       Shared Memory: 16318 MB
        Current Mode: 1920 x 1200 (32 bit) (59Hz)
         HDR Support: Not Supported
    Display Topology: Internal
 Display Color Space: DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
     Color Primaries: Red(0.673828,0.319336), Green(0.187500,0.706055), Blue(0.148438,0.064453), White Point(0.313477,0.329102)
   Display Luminance: Min Luminance = 0.500000, Max Luminance = 270.000000, MaxFullFrameLuminance = 270.000000
        Monitor Name: Generic PnP Monitor
       Monitor Model: DELL 2408WFP
          Monitor Id: DELA02C
         Native Mode: 1920 x 1200(p) (59.950Hz)
         Output Type: HDMI
Monitor Capabilities: HDR Not Supported
Display Pixel Format: DISPLAYCONFIG_PIXELFORMAT_32BPP
      Advanced Color: Not Supported
         Driver Name: C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_bf9afe57cbde0e11\igdumdim64.dll,C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_bf9afe57cbde0e11\igd10iumd64.dll,C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_bf9afe57cbde0e11\igd10iumd64.dll,C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_bf9afe57cbde0e11\igd12umd64.dll
 Driver File Version: 26.20.0100.6912 (English)
      Driver Version: 26.20.100.6912
         DDI Version: 12
      Feature Levels: 12_1,12_0,11_1,11_0,10_1,10_0,9_3,9_2,9_1
        Driver Model: WDDM 2.6
 Graphics Preemption: Triangle
  Compute Preemption: Thread
            Miracast: Supported
      Detachable GPU: No
 Hybrid Graphics GPU: Integrated
      Power P-states: Not Supported
      Virtualization: Paravirtualization 
          Block List: No Blocks
  Catalog Attributes: Universal:False Declarative:True 
   Driver Attributes: Final Retail
    Driver Date/Size: 28/05/2019 02:00:00, 1887728 bytes
         WHQL Logo`d: n/a
     WHQL Date Stamp: n/a
   Device Identifier: {D7B78E66-7DE5-11CF-36F8-1000BAC2D735}
           Vendor ID: 0x8086
           Device ID: 0x3EA5
           SubSys ID: 0x20748086
         Revision ID: 0x0001
  Driver Strong Name: oem4.inf:5f63e5341264f0f6:iCFL_w10_DS:26.20.100.6912:PCI\VEN_8086&DEV_3EA5

Extra note:
I now only have the included plugin projects in the solution, and use cinem4dsdk as startup project. No other plugins of mine are part of the solution.

This whole issue reminds me about this:
https://plugincafe.maxon.net/topic/11212/memory-leak-after-plugin-migration-r16-r20
Same situation, memory leaks not reproducible.

Warning: long and endless background drivel ahead ...

As mentioned before until R21 I was developing plugins on a laptop running Windows 8.1 and VS2015.
This laptop has an integrated nVidia Geforce 920m, next to the onboard Intel Graphics.
In the past I had upgraded to Windows 10 but didn't find acceptable stable video drivers and had to revert back after numerous crashes of the OS.
So, I kept using Windows 8.1. Which is the reason I couldn't install R21 and start developing. I thus purchased a new machine, and kept it simple: an Intel NUC having an 8th generation i5 CPU with integrated Intel Iris Plus Graphics 655. No dedicated graphics card, as I didn't plan on using this machine for 3D content creation, only for development purposes, and other less graphic related chores.

On the "old laptop" I kept developing for R20, and ported the code to R21 on "the NUC".
Due to some eID install mishap on the laptop I lost my dedicated graphics car and needed to figure out how to resolve this. In the meantime I reverted to using the integrated intel graphics for further development. It is at this point in time I discovered that on this trusty and rusty laptop I also started to experience the memory leaks I encountered on the NUC.
I was finally able to resolve the nVidia graphics issue and regained access to the dedicated graphics card (food for another story, I am sure).
Surpisingly, as soon as I was using the nVidia again I didn't encounter any memory leaks ... without any changes, except for activating the nVidia in the laptops' BIOS.

Now, I cannot try and do the same on the NUC, since it cannot accept any additional hardware (except eGPU ... which I am "budgetly" not enabled to access). I expect the same would be true for that machine. As soon as it would have a dedicated GPU it would be freed from all these memory leaks.
Question is now if these are actual memory leaks, or if these are "fake" reports from Visual Studio?

Anyway, the issue I had seems to be resolved.
I am not changing the status of this topic to "SOLVED" as I feel the issue isn't exactly solved.
For anyone running a system without dedicated GPU the issue will probably still be an issue.

I now understand why all you guys couldn't reproduce the issue in the first place. You probably have all kick-ass systems running heavy duty graphic cards.

Thanks Daniel for the extensive following up.

I'll check with our QA if there's a machine without a discrete graphic card in our testing environment that could confirm your issue. At the same time I'll rise attention of our viewport engineers on the topic.

Best, R.

Hi Daniel,

I just wanted to inform you that QA has been able to reproduce the issue. I've filed a bug report (ITEM#306240) and hope this to get solved soon.

Cheers, R

@r_gigante
Thanks for the feedback.

FYI, this wasn't only with R21, had the same issue with R20, since the "old laptop" was restricted to R20 only. But I guess no updates will follow for R20 anymore.