apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Broekhuis <a.broekh...@gmail.com>
Subject Re: Creating a pool returns a previously created instance
Date Tue, 17 May 2011 17:09:58 GMT
Hello,

In reply to my own mail, I have found the problem.

There was a duplicate apr_pool_destroy which resulted in this
unexpected behavior. All works as expected now :).

On 17 May 2011 18:36, Alexander Broekhuis <a.broekhuis@gmail.com> wrote:
> Hi,
>
> I have a problem with APR which is related to creating pools.
>
> In my software (Apache Celix), a library can be loaded/unloaded at
> runtime. Before the library is loaded, I create a memory pool to use
> by the loaded library. After unloading a library, the pool gets
> destroyed.
> In a test scenario I have two libraries which are almost identical.
> When starting the framework and loading the libraries for the first
> time, each library gets an own pool, which is what I expect to happen.
> But on a second load (after unloading the 2 libraries), they both end
> up using the same pool, which in turn result in unexpected behavior. A
> palloc returns a pointer to an already allocated block of memory.
>
> I tried reproducing this in a smaller example, but haven't succeeded
> yet. What did work was removing the apr_pool_destroy after the
> unloading. The result of this is that for each load a new pool is
> created. Of course this isn't a solution, because the old pool still
> uses memory.
>
> Is there some thing going on with the creation of pools which might be
> a problem in this case? Maybe some optimization? If so, can I force
> APR to create an actual new pool?
>
> Thanks in advance,
>
> --
> Met vriendelijke groet,
>
> Alexander Broekhuis
>



-- 
Met vriendelijke groet,

Alexander Broekhuis

Mime
View raw message