<div dir="ltr">Dear Marc,<div><br></div><div>Thanks for your help. It turned out that my problem was that I was trying to release the same variable twice due to having stored (a pointer to ) it in</div><div>two different places.</div><div><br></div><div>The page on memory management was very helpful. By compiling with NOBLKMEM=true NOBUFMEM=true NOBLKBUFMEM=true and using valgrind</div><div>I found two memory leaks I didn't even know I had!</div><div><br></div><div>James</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 22 April 2017 at 01:03, Marc Pfetsch <span dir="ltr"><<a href="mailto:pfetsch@mathematik.tu-darmstadt.de" target="_blank">pfetsch@mathematik.tu-darmstadt.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
Dear James,<br>
<br>
here are my thoughts about your issue: Capturing and releasing variables<br>
(and constraints) is the way SCIP handles a "smart pointer" via memory<br>
counts. Each time a variable is captured, the counter is increased by 1.<br>
Each time a variable is released the counter is decreased by 1. One the<br>
number reaches 0, the memory is actually freed. This should explain the<br>
message a bit.<br>
<br>
Moreover, not that due to the internal data structures of SCIP, the<br>
messages concerning the positions at which the memory was allocated are<br>
not accurate. It just shows that some memory has not been freed.<br>
<br>
The most common problem is that transformed and original variables are<br>
counted separately. Can you please check whether you are releasing the<br>
"right" version? I might also help to check the time within the solution<br>
process at which you are releasing the variables. Possibly, you release<br>
the variables before (or free the memory).<br>
<br>
Moreover, if you are on a Linux system you can try valgrind toghether<br>
with the makefile option "NOBLKBUFMEM=true", see<br>
<a href="http://scip.zib.de/doc/html/MEMORY.php" rel="noreferrer" target="_blank">http://scip.zib.de/doc/html/<wbr>MEMORY.php</a> (near the bottom).<br>
<br>
I hope that this helps ...<br>
<br>
Best<br>
<br>
Marc<br>
<br>
<br>
<br>
On 20.04.2017 11:30, James Cussens wrote:<br>
> I am having trouble working out when/how to release variables.<br>
><br>
> I have SCIP variables 'inside' my probdata. If I don't release them all<br>
> in my SCIP_DECL_PROBDELORIG function I get the following (but only in<br>
> OPT=dbg mode):<br>
><br>
> ....<br>
> WARNING: Original variable <edge#TbOrCa#XRay> not released when freeing<br>
> SCIP. Consider releasing variable first.<br>
> [src/blockmemshell/memory.c:<wbr>2503] ERROR: 320 bytes (4 elements of size<br>
> 80) not freed. First Allocator: src/scip/cons_pseudoboolean.c:<wbr>424<br>
> [src/blockmemshell/memory.c:<wbr>2503] ERROR: 768 bytes (12 elements of size<br>
> 64) not freed. First Allocator: src/scip/cons_nonlinear.c:9476<br>
> [src/blockmemshell/memory.c:<wbr>2503] ERROR: 1952 bytes (61 elements of size<br>
> 32) not freed. First Allocator: src/nlpi/expr.c:11977<br>
> [src/blockmemshell/memory.c:<wbr>2503] ERROR: 40584 bytes (89 elements of<br>
> size 456) not freed. First Allocator: src/scip/var.c:1900<br>
> [src/blockmemshell/memory.c:<wbr>2503] ERROR: 2256 bytes (94 elements of size<br>
> 24) not freed. First Allocator: src/scip/cons_nonlinear.c:9463<br>
> [src/blockmemshell/memory.c:<wbr>2503] ERROR: 28480 bytes (178 elements of<br>
> size 160) not freed. First Allocator: src/scip/cons_linear.c:533<br>
> [src/blockmemshell/memory.c:<wbr>2503] ERROR: 304 bytes (19 elements of size<br>
> 16) not freed. First Allocator: src/nlpi/expr.c:11977<br>
> [src/blockmemshell/memory.c:<wbr>2503] ERROR: 8 bytes (1 elements of size 8)<br>
> not freed. First Allocator: src/scip/cons_<wbr>bounddisjunction.c:3109<br>
> [src/blockmemshell/memory.c:<wbr>2521] ERROR: 74672 bytes not freed in total.<br>
><br>
> Note that I do not use most of the constraint handlers mentioned above,<br>
> e.g I do not use cons_pseudoboolean,<br>
><br>
><br>
> When I do release them all I get the following:<br>
> ...<br>
> gobnilp: src/scip/var.c:2663: varFree: Assertion `(*var)->probindex ==<br>
> -1' failed.<br>
> Aborted (core dumped)<br>
><br>
><br>
> Here's the gdb backtrace for that:<br>
> ...<br>
> gobnilp: src/scip/var.c:2663: varFree: Assertion `(*var)->probindex ==<br>
> -1' failed.<br>
><br>
> Program received signal SIGABRT, Aborted.<br>
> 0x00007ffff5db5428 in __GI_raise (sig=sig@entry=6) at<br>
> ../sysdeps/unix/sysv/linux/<wbr>raise.c:54<br>
> 54../sysdeps/unix/sysv/linux/<wbr>raise.c: No such file or directory.<br>
> (gdb) bt<br>
> #0  0x00007ffff5db5428 in __GI_raise (sig=sig@entry=6) at<br>
> ../sysdeps/unix/sysv/linux/<wbr>raise.c:54<br>
> #1  0x00007ffff5db702a in __GI_abort () at abort.c:89<br>
> #2  0x00007ffff5dadbd7 in __assert_fail_base (fmt=<optimised out>,<br>
> assertion=assertion@entry=<wbr>0x17ca38c "(*var)->probindex == -1",<br>
> file=file@entry=0x17c8e60 "src/scip/var.c", line=line@entry=2663,<br>
>     function=function@entry=<wbr>0x17d2e68 <__PRETTY_FUNCTION__.20324><br>
> "varFree") at assert.c:92<br>
> #3  0x00007ffff5dadc82 in __GI___assert_fail (assertion=0x17ca38c<br>
> "(*var)->probindex == -1", file=0x17c8e60 "src/scip/var.c", line=2663,<br>
> function=0x17d2e68 <__PRETTY_FUNCTION__.20324> "varFree") at assert.c:101<br>
> #4  0x0000000000d5a555 in varFree (var=0x7fffffffd0a0, blkmem=0x27d5f70,<br>
> set=0x27d8170, eventqueue=0x0, lp=0x0) at src/scip/var.c:2663<br>
> #5  0x0000000000d5b660 in SCIPvarRelease (var=0x7fffffffd0a0,<br>
> blkmem=0x27d5f70, set=0x27d8170, eventqueue=0x0, lp=0x0) at<br>
> src/scip/var.c:2782<br>
> #6  0x0000000000c07d83 in SCIPreleaseVar (scip=0x27d2f70,<br>
> var=0x7fffffffd0a0) at src/scip/scip.c:18398<br>
> #7  0x000000000048bcf3 in hashtablefreeArrow (scip=0x27d2f70,<br>
> psd=0x2a057d0, releasevars=1) at src/utils.c:212<br>
> #8  0x000000000045a7e9 in PS_deallocateParentSetData (scip=0x27d2f70,<br>
> psd=0x29fa9d0, releasevars=1) at src/parent_set_data.c:94<br>
> #9  0x000000000046508c in probdelorigBN (scip=0x27d2f70,<br>
> probdata=0x29fbb88) at src/probdata_bn.c:96<br>
> #10 0x0000000000b48c07 in SCIPprobFree (prob=0x27d2fa8,<br>
> messagehdlr=0x27d3090, blkmem=0x27d5f70, set=0x27d8170, stat=0x29faa50,<br>
> eventqueue=0x0, lp=0x0) at src/scip/prob.c:448<br>
> #11 0x0000000000bd1312 in SCIPfreeProb (scip=0x27d2f70) at<br>
> src/scip/scip.c:10409<br>
> #12 0x00000000004aa060 in main (argc=2, argv=0x7fffffffd8e8) at<br>
> src/gobnilp.c:516<br>
><br>
> Any ideas out there and what is going on, and how to fix it?<br>
><br>
> James<br>
><br>
> --<br>
> James Cussens<br>
> Dept of Computer Science &<br>
> York Centre for Complex Systems Analysis<br>
> Room 326, The Hub, Deramore Lane            Tel    +44 (0)1904 325371<br>
> University of York                                        Fax  +44<br>
> (0)1904 500159<br>
> York YO10 5GE, UK<br>
> <a href="http://www.cs.york.ac.uk/~jc" rel="noreferrer" target="_blank">http://www.cs.york.ac.uk/~jc</a> <<a href="http://www.cs.york.ac.uk/%7Ejc" rel="noreferrer" target="_blank">http://www.cs.york.ac.uk/%<wbr>7Ejc</a>><br>
> <a href="http://www.york.ac.uk/docs/disclaimer/email.htm" rel="noreferrer" target="_blank">http://www.york.ac.uk/docs/<wbr>disclaimer/email.htm</a><br>
><br>
><br>
> ______________________________<wbr>_________________<br>
> Scip mailing list<br>
> <a href="mailto:Scip@zib.de">Scip@zib.de</a><br>
> <a href="https://listserv.zib.de/mailman/listinfo/scip" rel="noreferrer" target="_blank">https://listserv.zib.de/<wbr>mailman/listinfo/scip</a><br>
><br>
______________________________<wbr>_________________<br>
Scip mailing list<br>
<a href="mailto:Scip@zib.de">Scip@zib.de</a><br>
<a href="https://listserv.zib.de/mailman/listinfo/scip" rel="noreferrer" target="_blank">https://listserv.zib.de/<wbr>mailman/listinfo/scip</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">James Cussens<br>Dept of Computer Science &<br>York Centre for Complex Systems Analysis<br>Room 326, The Hub, Deramore Lane            Tel    +44 (0)1904 325371<br>University of York                                        Fax  +44 (0)1904 500159<br>York YO10 5GE, UK                               <a href="http://www.cs.york.ac.uk/~jc" target="_blank">http://www.cs.york.ac.uk/~jc</a><br><a href="http://www.york.ac.uk/docs/disclaimer/email.htm" target="_blank">http://www.york.ac.uk/docs/disclaimer/email.htm</a></div>
</div>