Explicit memory deallocation

Neil Vice psgdg at swiftdsl.com.au
Mon Mar 10 08:26:27 PDT 2008


"Julian Schick" <julianschick at gmx.net> wrote:
> I suppose, regarding these facts, that the GC is still running.
> Am I not correctly disabling the GC?
> If it is running, can't I free memory explicitely without disturbing the 
> gc?
> Are there any issues known which could be the reason for my problem?
>
> Greetings
> Julian Schick

"disable() temporarily disables garbage collection cycle, enable() then 
reenables them."

Given this I suspect that the GC still expects to be in control of memory so 
even though the GC thread may not be running dynamically freeing things, 
constructor calls will still register pointers with the GC and expect some 
sort of internal consistency you are breaking with explicit destroys 
perhaps...

Having said that, are the variables you're destroying "scope" at all 
(including "in" parameters)? If so then my understanding was that 
independantly of the GC thread these would be freed automatically when they 
go out of scope, resulting in them being destroyed twice if destroyed 
explicitly perhaps.

Evidently I'm no expert but hopefully I've given you some ideas =) 





More information about the Digitalmars-d mailing list