[geos-devel] Unclear objects lifetime and ownership issues in Monotone Chain components

Martin Davis mbdavis at refractions.net
Wed Sep 24 11:43:29 EDT 2008


Good point, Sandro - I always thought that a limitation of the smart-ptr 
/ reference counting technique was that it couldn't handle circular 
references correctly.  The JTS internals are *full* of circular 
structures (e.g. all the graph structures)

We've experimented with GCJ, with mixed results.  The code compiles 
fine, but we were seeing mysterious crashes sporadically under use in 
PostGIS.  Seems like a great way to go if someone can figure it out, though.

strk wrote:
> On Wed, Sep 24, 2008 at 04:56:29PM +0200, Mateusz Loskot wrote:
>   
>> strk wrote:
>>     
>>> Truth is (and you know): GEOS needs a GC !
>>> Can't keep being considered 1:1 mapping with JTS if doesn't have one...
>>>       
>> Any particular GC technique you have in mind?
>>
>> IMHO, one of possible and clean solution for this kind of issues in GEOS
>> is to apply GC in form of shared_ptr - smart pointer that controls
>> lifetime of objects and frees developers from knowing *when* an object
>> is/should be deallocated.
>>     
>
> As long as you're sure no circular references exist, shared_ptr 
> wuold be fine. But the point is if we GEOS needs to directly
> map JTS algorithms, they are based on a conservativ
> garbage collector.
>
> GCJ uses the bohem one, and is very nice.
> Ever tried to build JTS natively ?
>
> --strk;
> _______________________________________________
> geos-devel mailing list
> geos-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geos-devel
>
>   

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022



More information about the geos-devel mailing list