[geos-devel] Re: geos-devel Digest, Vol 67, Issue 5
wang.yongjie.2008 at gmail.com
Thu May 8 22:29:08 EDT 2008
> Message: 2
> Date: Thu, 08 May 2008 05:37:19 +0200
> From: Mateusz Loskot <mateusz at loskot.net>
> Subject: Re: [geos-devel] Re: Memory leak in RelateComputer?
> To: GEOS Development List <geos-devel at lists.osgeo.org>
> Message-ID: <4822756F.4070502 at loskot.net>
> Content-Type: text/plain; charset=ISO-2022-JP
> First, you should know that modifying a single class in GEOS is not that
> easy as it seems. There are rich and complex relations between GEOS
> types. I've not analysed this particular issue deeply, so I can't answer
> how to solve it better.
I totally understand.
> However, there are a few solutions potentially possible:
> 1. Use lazy allocation of matrix, means to not allocate the matrix in
> the RelateComputer ctor but to allocate it on request, when the computer
> is asked for it.
> 2. Make RelateComputer an exclusive owner of the matrix, and destroy it
> in the dctor. Then, RelateComputer could give access to immutable matrix
> by reference to const (not pointer!).
> 3. Introduce shared ownership by wrapping the matrix object with smart
> pointer implementing shared resource semantic (ie. boost::shared_ptr).
> The 3rd option *seems* to fit best in this case.
I think the first method is the best to solve this problem, it's simple and
easy to implement and the interface of RelateComputer needn't to alter.
> I'm not eager to alter any patterns and semantics currently implemented
> without a wider discussion. I think changes of that kind are serious and
> should follow submission of Request For Comments (RFC) document,
> discussed and voted by the GEOS PSC.
> The PSC has just formed and we have not started up yet.
> For now, we have to remember how to properly use RelateComputer to avoid
> memory leaks.
I agree with you.
It's very kind of you to do me a favor.
Thanks for your help.
Best regards to you.
Tel: +86(10)8282 5800 Ext. 8411
Fax: +86(10)8282 5816
Email: yongjiemail at gmail.com
MSN/Gtalk: yongjiemail at gmail.com
More information about the geos-devel