[M3devel] GC question
Darko
darko at darko.org
Mon Jan 14 22:28:18 CET 2008
Yep, I want to replace one object with another. One application is to
expand open arrays without searching large data structures for
references to replace. Maybe a simpler question is can you increase
the size of an allocated object without getting messy?
On 14/01/2008, at 1:17 PM, Tony Hosking wrote:
> I'm not sure what your purpose here might be. You shouldn't assume
> anything about an object's precise location since the collector is
> free to move it around. What are you trying to do? If you are
> trying to *replace* one object with another and have all references
> to the old object refer to the new object, then, yes, you really
> need to get intimately involved with the GC, since it will need to
> go through the whole heap and redirect those references. It is
> doable, but messy, and probably requires that all threads in the
> system be stopped while you pull off the switch. To do it without
> stopping all the threads requires that you do something much smarter
> (see papers on replicating GC...).
>
> On Jan 14, 2008, at 3:53 PM, Mika Nystrom wrote:
>
>> It would have to be able to return an error, no? If there's
>> an ambiguous root pointing to the object...
>>
>>
>> Darko writes:
>>> Tony,
>>>
>>> I imagine you're intimately familiar with the garbage collector
>>> implementation. If I wanted to implement a 'reallocate' function
>>> that
>>> preserved references to an object although the object was
>>> reallocated,
>>> ie change all existing references from the old object to the new
>>> object, would this be straight forward using the code of the current
>>> GC implementation? Is there any existing function that might do
>>> something like this already?
>>>
>>> Thanks,
>>> Darko.
>
More information about the M3devel
mailing list