FW: [Coin-discuss] Fix small memory leak in Bcp/LP/BCP_lp.cpp (fwd)

Emil Soelberg Frisendal emil at diku.dk
Wed Jun 9 16:47:42 EDT 2004


Hi Simon,

I see a similar (or perhaps the same) leak in my solution.
I tried your patch, which does not change the behaviour of the program -
which is good :-)

I made 3 quick tests to see how the BCP_user_data (and inherited) is
handled, since I suspect a memory leak here. I simply printed a char for
each new and likewise for each delete.
It all sums up to that n+1 BCP_user_data objects are not destructed, where
n is the number of nodes in the branch tree - even with your patch.

Since I have about 120kb data in each user_data, and in some cases over a
1000 nodes, it adds up.

I tested with 3, 68, and 635 nodes, using 4 candidates in strong
branching. My program is based on the AAP example by Matthew Galati,
Lehigh University (a
very good tutorial on VG).

I'm not sure where to fix this. Any ideas will be appreciated.

BR,
Emil S. Frisendal
Graduate Student
Department of Computer Science
University of Copenhagen


-----Original Message-----
From: coin-discuss-admin at www-124.ibm.com
[mailto:coin-discuss-admin at www-124.ibm.com] On Behalf Of Simon Barner
Sent: 23. maj 2004 19:18
To: coin-discuss at oss.software.ibm.com
Subject: [Coin-discuss] Fix small memory leak in Bcp/LP/BCP_lp.cpp


Hello,

while I tested my BCP application with valgrind
(http://valgrind.kde.org), I found a memory leak, and developed the
following patch:

--- COIN.old/Bcp/LP/BCP_lp.cpp	Sat Oct  4 05:41:33 2003
+++ COIN/Bcp/LP/BCP_lp.cpp	Sun May 23 18:26:09 2004
@@ -98,6 +98,7 @@
    delete local_var_pool;
    delete local_cut_pool;

+   delete msg_env;
    // these are vectors of ptrs, but they need not be purged. they just
point
    // into the appropriate fields of p.node->vars/cuts
    //    purge_ptr_vector(all_vars);

Perhaps this is not the right solution, but you might get an idea about
where the real cause for the leak is. It is quite possible that similar
leaks exist for the VG and CG modules as well.

Regards,
 Simon Barner

(Please Cc: me in your replies, I am not subscribed to the list)



More information about the Coin-discuss mailing list