[fpc-devel] Improving Ref Counting

Jamie McCracken jamie-junk at blueyonder.co.uk
Sun Feb 27 13:01:01 CET 2005


Marco van de Voort wrote:
>>circular refs should also be done if applicable)
>>6) Whenever an exception is thrown, wait until its either handled or 
>>fully propagated and then perform some garbage collection. (traverse the 
>>single linked list of all managed objects and for each object check 
>>whether anything that references it is still valid and delete if 
>>appropriate).
> 
> 
> I also thought immediately what Uberto already said: how do you recognize
> a valid/invalid reference without accessing memory that is invalid in the mean
> time.

How does a GC do this? It would have the same problem?

> 
> Also note that the list of references must be a dynamically size structure,
> incurring getmem and size-change overhead on a simple assignment.

yes a "single linked list" is a very efficient dynamically sized 
structure and much cheaper than try..finally or using Tlist.

> 
> I doubt performance would improve, specially since the edge of this problem
> (the worst 90%) can be taken off by simply disabling try...finally generation
> in places where they are unlikely to happen.

Is there a real failsafe way of doing that?

jamie.

> 
> 
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 
> 





More information about the fpc-devel mailing list