Re: FastMM and garbage collection...



Atmapuri wrote:
And on the subject: Do you think it is feasible to try garbage colecting
TObject's by extending fastMM?

It seems to me that the memory manager has all the information required
to implement something like that...
Except that a) you have no control over all the threads in the
application and can't suspend them in a "safe" position while doing a
collection cycle and b) you don't have any reliable way to identify
pointers referencing the objects. Such references could be pretty much
everywhere on the heap, in the stack of any thread, in cpu registers,
and even in the "saved" thread context of threads that are currently not
running (which is stored somewhere in the kernel address space IIRC).

So how would your garbage collector determine which objects are no
longer referenced? A garbage collector usually requires that you are in
total control of all threads and have complete type information about
any place where references to garbage collected allocations might be
stored.

Cheers,
Thorsten
.



Relevant Pages

  • Re: Python language problem
    ... references and you cannot free an object. ... The garbage collector will do it for you automatically, ... access the resource, ... I create same object in Tree, I want to update Tree, when I need to ...
    (comp.lang.python)
  • Re: Setting objects to Nothing uses less memory!
    ... The garbage collector only does one pass and frees ... "bigObjects" and its internal instance of "lotsOfData" in the first ... > I think people often get confused about setting references to null. ... > The key is your InternalSetNull() method. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Dispose must be thread-safe ?
    ... > I admit that due to my limited knowledge of GC-ing in .NET I was not able to ... > other thread still references it and even calls Dispose method on it)?? ... method would include an implicit "root" (from the garbage collector's ... it doesn't stop the garbage collector from trying to ...
    (microsoft.public.dotnet.framework.clr)
  • Re: does python have useless destructors?
    ... "Called by the garbage collector on an object when garbage collection ... determines that there are no more references to the object." ... Let Java code ... > use Java idioms. ...
    (comp.lang.python)