apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cosmin Luță <cosmin.l...@avira.com>
Subject APR threadpool and memory pool weirdness
Date Wed, 27 Jul 2011 10:15:49 GMT
Hi all,

I have a rather strange use case for APR which leads to quick memory
increase on Linux (at least): a program creates (in a loop) memory
pools which are passed to tasks in a threadpool. Each task will call
apr_pool_destroy on its pool (received as an argument). 

You can see the demo code here:

http://pastebin.com/KWPKsLrc

You can try to compile with:

gcc -g -O0 -o test_pools  `apr-1-config --cflags --includes
--cppflags`  -lapr-1 -laprutil-1 test_pools.c  

This is what I compile against (on an OpenSUSE 11.4 machine):

% rpm -qa | grep libapr
libapr-util1-debuginfo-1.3.9-9.2.x86_64
libapr1-devel-1.4.2-3.1.x86_64
libapr-util1-devel-1.3.9-9.2.x86_64
libapr-util1-1.3.9-9.2.x86_64
libapr1-1.4.2-3.1.x86_64
libapr1-debuginfo-1.4.2-3.1.x86_64


So, can anyone tell me what I'm missing here? I'm aware that it's not
very usual to create a pool in a thread, then pass it as a pointer to
another, but I don't think that's the source of the memory increase.
Any ideas what I can do to stop this from happening?


Best regards,


-- 
-- 
Cosmin Luță
Software Developer
AVIRA Soft srl



Mime
View raw message