C Memory

Benjamin Thaut code at benjamin-thaut.de
Sun May 12 14:05:19 PDT 2013


Am 12.05.2013 12:11, schrieb Namespace:
> I get the error, although I don't call any unload method (or quit any
> SDL component) and although I recompiled derelict3, where I comment out
> all static (shared) DTor's.
> Maybe the only solution would be (as you said) to transfer all
> deallocations into a terminate method, but that is no opinion for me
> (and would cause a growing memory, if the game runs a long time). And I
> want to use RAII. So I must live with this invalid memory error.
> But thanks to you and all others for your help. :)

Do you have multiple threads in your application? If you do so it is 
possible that you (or the derelict library) does a API call in a 
different then the main thread which might lead to the error you 
describe. As the GC runs the destructors in any arbitrary thread you can 
not free any SDL resources inside a destructor.

-- 
Kind Regards
Benjamin Thaut


More information about the Digitalmars-d-learn mailing list