[SCIP] releasing variables

Marc Pfetsch pfetsch at mathematik.tu-darmstadt.de
Sat Apr 22 02:03:39 CEST 2017



Dear James,

here are my thoughts about your issue: Capturing and releasing variables
(and constraints) is the way SCIP handles a "smart pointer" via memory
counts. Each time a variable is captured, the counter is increased by 1.
Each time a variable is released the counter is decreased by 1. One the
number reaches 0, the memory is actually freed. This should explain the
message a bit.

Moreover, not that due to the internal data structures of SCIP, the
messages concerning the positions at which the memory was allocated are
not accurate. It just shows that some memory has not been freed.

The most common problem is that transformed and original variables are
counted separately. Can you please check whether you are releasing the
"right" version? I might also help to check the time within the solution
process at which you are releasing the variables. Possibly, you release
the variables before (or free the memory).

Moreover, if you are on a Linux system you can try valgrind toghether
with the makefile option "NOBLKBUFMEM=true", see
http://scip.zib.de/doc/html/MEMORY.php (near the bottom).

I hope that this helps ...

Best

Marc



On 20.04.2017 11:30, James Cussens wrote:
> I am having trouble working out when/how to release variables.
> 
> I have SCIP variables 'inside' my probdata. If I don't release them all
> in my SCIP_DECL_PROBDELORIG function I get the following (but only in
> OPT=dbg mode):
> 
> ....
> WARNING: Original variable <edge#TbOrCa#XRay> not released when freeing
> SCIP. Consider releasing variable first.
> [src/blockmemshell/memory.c:2503] ERROR: 320 bytes (4 elements of size
> 80) not freed. First Allocator: src/scip/cons_pseudoboolean.c:424
> [src/blockmemshell/memory.c:2503] ERROR: 768 bytes (12 elements of size
> 64) not freed. First Allocator: src/scip/cons_nonlinear.c:9476
> [src/blockmemshell/memory.c:2503] ERROR: 1952 bytes (61 elements of size
> 32) not freed. First Allocator: src/nlpi/expr.c:11977
> [src/blockmemshell/memory.c:2503] ERROR: 40584 bytes (89 elements of
> size 456) not freed. First Allocator: src/scip/var.c:1900
> [src/blockmemshell/memory.c:2503] ERROR: 2256 bytes (94 elements of size
> 24) not freed. First Allocator: src/scip/cons_nonlinear.c:9463
> [src/blockmemshell/memory.c:2503] ERROR: 28480 bytes (178 elements of
> size 160) not freed. First Allocator: src/scip/cons_linear.c:533
> [src/blockmemshell/memory.c:2503] ERROR: 304 bytes (19 elements of size
> 16) not freed. First Allocator: src/nlpi/expr.c:11977
> [src/blockmemshell/memory.c:2503] ERROR: 8 bytes (1 elements of size 8)
> not freed. First Allocator: src/scip/cons_bounddisjunction.c:3109
> [src/blockmemshell/memory.c:2521] ERROR: 74672 bytes not freed in total.
> 
> Note that I do not use most of the constraint handlers mentioned above,
> e.g I do not use cons_pseudoboolean, 
> 
> 
> When I do release them all I get the following:
> ...
> gobnilp: src/scip/var.c:2663: varFree: Assertion `(*var)->probindex ==
> -1' failed.
> Aborted (core dumped)
> 
> 
> Here's the gdb backtrace for that:
> ...
> gobnilp: src/scip/var.c:2663: varFree: Assertion `(*var)->probindex ==
> -1' failed.
> 
> Program received signal SIGABRT, Aborted.
> 0x00007ffff5db5428 in __GI_raise (sig=sig at entry=6) at
> ../sysdeps/unix/sysv/linux/raise.c:54
> 54../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
> (gdb) bt
> #0  0x00007ffff5db5428 in __GI_raise (sig=sig at entry=6) at
> ../sysdeps/unix/sysv/linux/raise.c:54
> #1  0x00007ffff5db702a in __GI_abort () at abort.c:89
> #2  0x00007ffff5dadbd7 in __assert_fail_base (fmt=<optimised out>,
> assertion=assertion at entry=0x17ca38c "(*var)->probindex == -1",
> file=file at entry=0x17c8e60 "src/scip/var.c", line=line at entry=2663, 
>     function=function at entry=0x17d2e68 <__PRETTY_FUNCTION__.20324>
> "varFree") at assert.c:92
> #3  0x00007ffff5dadc82 in __GI___assert_fail (assertion=0x17ca38c
> "(*var)->probindex == -1", file=0x17c8e60 "src/scip/var.c", line=2663,
> function=0x17d2e68 <__PRETTY_FUNCTION__.20324> "varFree") at assert.c:101
> #4  0x0000000000d5a555 in varFree (var=0x7fffffffd0a0, blkmem=0x27d5f70,
> set=0x27d8170, eventqueue=0x0, lp=0x0) at src/scip/var.c:2663
> #5  0x0000000000d5b660 in SCIPvarRelease (var=0x7fffffffd0a0,
> blkmem=0x27d5f70, set=0x27d8170, eventqueue=0x0, lp=0x0) at
> src/scip/var.c:2782
> #6  0x0000000000c07d83 in SCIPreleaseVar (scip=0x27d2f70,
> var=0x7fffffffd0a0) at src/scip/scip.c:18398
> #7  0x000000000048bcf3 in hashtablefreeArrow (scip=0x27d2f70,
> psd=0x2a057d0, releasevars=1) at src/utils.c:212
> #8  0x000000000045a7e9 in PS_deallocateParentSetData (scip=0x27d2f70,
> psd=0x29fa9d0, releasevars=1) at src/parent_set_data.c:94
> #9  0x000000000046508c in probdelorigBN (scip=0x27d2f70,
> probdata=0x29fbb88) at src/probdata_bn.c:96
> #10 0x0000000000b48c07 in SCIPprobFree (prob=0x27d2fa8,
> messagehdlr=0x27d3090, blkmem=0x27d5f70, set=0x27d8170, stat=0x29faa50,
> eventqueue=0x0, lp=0x0) at src/scip/prob.c:448
> #11 0x0000000000bd1312 in SCIPfreeProb (scip=0x27d2f70) at
> src/scip/scip.c:10409
> #12 0x00000000004aa060 in main (argc=2, argv=0x7fffffffd8e8) at
> src/gobnilp.c:516
> 
> Any ideas out there and what is going on, and how to fix it?
> 
> James
> 
> -- 
> James Cussens
> Dept of Computer Science &
> York Centre for Complex Systems Analysis
> Room 326, The Hub, Deramore Lane            Tel    +44 (0)1904 325371
> University of York                                        Fax  +44
> (0)1904 500159
> York YO10 5GE, UK                              
> http://www.cs.york.ac.uk/~jc <http://www.cs.york.ac.uk/%7Ejc>
> http://www.york.ac.uk/docs/disclaimer/email.htm
> 
> 
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip
> 


More information about the Scip mailing list