[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Nil-ing userdata
- From: Drake Wilson <drake@...>
- Date: Sat, 23 Oct 2010 05:33:12 -0700
Quoth David Pirrò <david.pirro@gmail.com>, on 2010-10-23 14:22:27 +0200:
> Is there a possibility to "force" the garbage collection?
No. Why do you need to do this? Overwrite the contents of the
userdata with a recognizable invalid state, then make further
operations on it fail (and any finalizer do nothing instead). If you
have a giant piece of memory that you need to free immediately or
something, make the userdata only contain a pointer there, and then
free the memory yourself in the dispose operation.
Think about what you're describing: you're asking for every reference
from anywhere in the heap to suddenly become something else. It's not
impossible to design a GC scheme that allows this, but it tends to be
either very expensive (scanning the entire heap) or pretty complicated
and not as useful as you think (using forwarding pointers).
> David
---> Drake Wilson