[fpc-devel] refcounting in fcl-passrc
Michael Van Canneyt
michael at freepascal.org
Sun Aug 22 11:46:02 CEST 2010
On Sun, 22 Aug 2010, Marco van de Voort wrote:
> In our previous episode, Michael Van Canneyt said:
>>> Since in both cases the resultparent is an already used reference, shouldn't
>>> it be increfed ?
>> Till you told me, I wasn't even aware that there was a refcounting mechanism.
>> I see no reason why there should be one, so I'd be in favour of removing it
> Then you need some global list to add them to. (to be able to deallocate).
> It might be the various TPasModule sections already double as something like
> this, but that has to be validated.
Each element should deallocate it's "children".
Since an element tree is always a strict tree, this is unambiguous.
Refcounting is not needed at all.
I'm not in favour of a global list and a 'garbage collection' style of memory
management. It makes manipulating the tree a pain.
This will take some reworking, apparently (each destructor must be filled
with code to deallocate children). For the time being, try the incref.
More information about the fpc-devel