[Symphony-tickets] [SYMPHONY] #154: Memory leak in generate_cuts_in_lp_u()

SYMPHONY coin-trac at coin-or.org
Mon Oct 22 18:55:20 EDT 2018


#154: Memory leak in generate_cuts_in_lp_u()
-------------------------+--------------------
 Reporter:  casper       |      Owner:  tkr
     Type:  defect       |     Status:  new
 Priority:  normal       |  Milestone:  5.2
Component:  LP           |    Version:  5.6.16
 Keywords:  memory leak  |
-------------------------+--------------------
 The following in lp_wrapper.c::generate_cuts_in_lp_u() has a memory leak:

       /* Test whether any of the new cuts are identical to any of
          the old ones. */
       if (p->waiting_row_num && new_row_num){
          for (i = 0, deleted_cut = FALSE; i < new_row_num;
               deleted_cut = FALSE){
             for (j = p->waiting_row_num - 1; j >= 0; j--){
                if (same_cuts_u(p, p->waiting_rows[j], new_rows[i]) !=
                    DIFFERENT_CUTS){
                   free_waiting_row(new_rows+i);
                   new_rows[i] = new_rows[--new_row_num];
                   deleted_cut = TRUE;
                   break;
                }
             }
             if (!deleted_cut) i++;
          }
       }
 /* CNMCNMCNM
  * leaks memory as if all cuts are the same as previously new_row_num will
 become 0,
  * and then new_rows will not be freed.  Suggest to move FREE(new_rows)
 outside of if
  * statement.
  */
       if (new_row_num){
          add_new_rows_to_waiting_rows(p, new_rows, new_row_num);
 /*       FREE(new_rows);  CNM suggest moving free from here */
       }
       FREE(new_rows); /* CNM to here*/

       FREE(cuts);

--
Ticket URL: <https://projects.coin-or.org/SYMPHONY/ticket/154>
SYMPHONY <http://projects.coin-or.org/SYMPHONY>
The SYMPHONY framework for parallel branch-and-cut algorithms.



More information about the Symphony-tickets mailing list