C Memory

Namespace rswhite4 at googlemail.com
Sun May 5 00:23:24 PDT 2013


On Sunday, 5 May 2013 at 06:43:17 UTC, Diggory wrote:
> On Sunday, 5 May 2013 at 06:35:38 UTC, Namespace wrote:
>> Quick question: I have a SDL_Surface in one of my classes and 
>> the SDL_Surface contains (obviously) memory to the pixel data. 
>> Since I cannot free this memory with the DTor: what will 
>> happen? AFAIK this cannot be freed by the GC because it was 
>> not allocated by it. So AFAIK this creates a memory leak. Am I 
>> right?
>
> Why can't you free the memory from the destructor?

Every time I tried this, I got this: 
core.exception.InvalidMemoryOperationError
I do not know if I get that, because the GC has already cleaned 
this store or because of something else.


More information about the Digitalmars-d-learn mailing list