Re: [libdbi-users] Memory leak when using dbi_initialize in loop

2011-08-03 Thread Shakthi Kannan
Hi Markus:

--- On Wed, Aug 3, 2011 at 12:41 PM, Markus Hoenicka
 wrote:
| In any case, I'd suggest to modify your code. dbi_initialize() is
| supposed to be run once per process
\--

I have changed this. If I try to comment the invocation call to
dbi_conn_connect(conn), then I don't see any increase in dynamic
memory allocation. I check with 'pmap -x ' and observe the
mapping entry of "[ anon ]" in its output.

Thanks for the quick reply!

SK

-- 
Shakthi Kannan
http://www.shakthimaan.com

--
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users


Re: [libdbi-users] Memory leak when using dbi_initialize in loop

2011-08-03 Thread Markus Hoenicka
Shakthi Kannan  was heard to say:

> int main() {
>   dbi_conn conn;
>
>   while (1) {
> dbi_initialize(NULL);
>
[...]
>
> dbi_shutdown();
>   }
>
>   return 0;
> }

Hi,

I'll test your code on my dev box as soon as time permits. libdbi is  
not supposed to lose memory under any circumstances. I'll have to see  
the valgrind output as sometimes the leak is not within libdbi itself,  
but within a driver or the client library (if the driver forgets to  
free memory allocated by the library).

In any case, I'd suggest to modify your code. dbi_initialize() is  
supposed to be run once per process, so the following is more  
appropriate:

int main() {
   dbi_conn conn;

   dbi_initialize(NULL);
   while (1) {

[...]

   }
   dbi_shutdown();

   return 0;
}

If it is indeed libdbi that leaks memory, it won't do so in every  
cycle of your loop.

regards,
Markus

-- 
Markus Hoenicka
http://www.mhoenicka.de
AQ score 38



--
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
___
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users