You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Amit Athavale <am...@persistent.co.in> on 2004/02/25 10:31:32 UTC
memory growth
Hi,
I came across following strange(?) behavior while fixing a problem.
----------------
apr_pool_t *pool;
thread 1--->put data on pool--->---->apr_pool_clear(pool)--->put back
new data on pool
^
|
thread 2 ---> accesses data at this point -------------------------
----------------
Clearly this is a bug in my code (it tries to access data on cleared
pool), but the
strange behavior is, I see increase in memory usage of a process (used
"pmem <pid> | grep heap")
Anyway I have fixed it by putting locks around (and that stops memory
growth !)
But it will be better if somebody explains why memory increase in such
case ?
Sorry if I am asking obvious question.
TIA
Amit.
Re: memory growth
Posted by Amit Athavale <am...@persistent.co.in>.
Sorry for bad formatting, basically arrow should be in between
apr_pool_clear() and
"put back new data on pool".
Amit Athavale wrote:
> Hi,
>
> I came across following strange(?) behavior while fixing a problem.
>
> ----------------
> apr_pool_t *pool;
>
> thread 1--->put data on pool--->---->apr_pool_clear(pool)--->put back
> new data on pool
>
> ^
>
> |
> thread 2 ---> accesses data at this point -------------------------
> ----------------
>
> Clearly this is a bug in my code (it tries to access data on cleared
> pool), but the
> strange behavior is, I see increase in memory usage of a process (used
> "pmem <pid> | grep heap")
>
> Anyway I have fixed it by putting locks around (and that stops memory
> growth !)
>
> But it will be better if somebody explains why memory increase in such
> case ?
> Sorry if I am asking obvious question.
>
>
> TIA
> Amit.
>
>