[Gdal-dev] Re: GetGeometryRef in scripts

Ari Jolma ari.jolma at tkk.fi
Wed Sep 21 04:36:00 EDT 2005


Charlie Savage wrote:

>> An object must know about its' container, so that when the object is 
>> really destroyed, the destructor needs to check the container, and 
>> destroy also it, if it isn't referenced by anybody else.
>
>
> In OGR an object does not know its container.


Yes, and that I see as the missing piece. But I'm willing to live 
without it.

> I actually think the better approach is use the garbage collector of 
> the scripting language (i.e., how to keep the container alive as 
> discussed above).


Those languages which rely on reference counting in gc, can't handle a 
case where a container, which is kept alive by increasing its reference 
count, is not referenced by any variable -- it just does not get deleted 
at all, thus in

lyr = datasource("xx").getlayer

the anonymous datasource object does not get deleted if lyr is a working 
reference to its part.

Either lyr has to become a stale variable so that it is noticeable in 
the variable (and its subsequent use can be blocked automatically), or 
something in lyr has to know that the anonymous datasource object is its 
parent, i.e., have a pointer to it (see above).

Ari


-- 
Prof. Ari Jolma
Kartografia ja Geoinformatiikka / Cartography and Geoinformatics
Teknillinen Korkeakoulu / Helsinki University of Technology
POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma




More information about the Gdal-dev mailing list