On 30/05/2013 at 08:29, xxxxxxxx wrote:
But I do care if I have memory leaks in my python plugins.
I care a lot. Even if it's not my fault.
I need to know if I can rely 100% on Python to handle this correctly for me when I use things that are in the SDK.
@Frank,
In my C++ version. I'm getting memory leaks from the tag plugin.
If I add a BaseBitmap::Free(the specific bitmap here) at the end of the Copy(), and Read() methods. I can fix those leaks. But then it makes the plugin not work correctly.
Specifically. It doesn't save the images to the saved document's hyperfile. So when the .c4d file is opened again. Those images are gone when the GedDialog tries to use them. And I also can't select things with the mouse because it messes up the CopyTo() method.
The other error I get is when I do an insert(render,i) to the array of images in the tag.
I do this remotely from the GeDialog.
The reason for this code is to update an existing Bitmap Button's image by changing a specific image in the tag's image array.
I do this by deleting a specific image in the array(Remove(i)). And inserting a new one in the same array index position(Insert(render,i)). So my GeDailog Buttons always stays in sync with the array of images in the tag.
In simpler words. I find the specific image in the array I want to change. Then I delete it and replace it with a different one. Using the images array index position to do this.
But those three methods Read(), Write(), and CopyTo() don't like it when I do this "Insert()" thing.
The VS output error is:
First-chance exception at 0x0000000140d2ea21 in CINEMA 4D 64 Bit.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.
Unhandled exception at 0x0000000140d2ea21 in CINEMA 4D 64 Bit.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.
And VS also opens a page pointing to this:
void BaseBitmap::Free(BaseBitmap *&bm)
{
C4DOS.Bm->Free(bm);
bm=NULL;
}
I think what's happening is that when I replace an image in the array by using Remove() then Insert(). The Read(),Write, CopyTo() methods are not updating properly to see that change.
If interested. The plugins can be downloaded from my site. With all of the source code: https://sites.google.com/site/scottayersmedia/plugins
The thing that's making my memory so hard to manage it those frack'n three methods.
Read(), Write, & CopyTo(). I hate them.
The reason I made a Python version was because I couldn't fix the debugging errors in the C++ version. But now I'm worried about my Python version too.
I just want to make 100% sure that the Python is truly working properly. And not leaking memory too.
-ScottA