C Memory

Johannes Pfau nospam at example.com
Sat May 11 00:03:18 PDT 2013


Am Sun, 05 May 2013 11:52:52 +0200
schrieb "Namespace" <rswhite4 at googlemail.com>:

> Here a test example:
> http://dpaste.1azy.net/2cfc8ead
> 
> The memory is allocated through the SDL as you can see.

Sorry for this late reply, I actually hoped someone else would coma up
with a solution. I don't have SDL2 here so I can't test that program
but it looks correct to me.

Does this also happen if the GC collection is not at program exit? So
if you place the surface creation to a separate function, make sure
it's no longer reachable and then force a GC collection, will it still
cause the Exception?

Are you sure you can still access the surface (i.e. call FreeSurface)
after you already called SDL_DestroyWindow on the last window? I don't
know SDL enough, but that sounds a little dangerous to me.


More information about the Digitalmars-d-learn mailing list