[SCIP] Memory Allocation

Stefan Vigerske svigerske at gams.com
Thu Sep 24 18:09:44 CEST 2020


Hi,

On 9/23/20 12:24 PM, Wang, Tony Congqian wrote:
> Hello,
> 
> 
> I have found a bug in branch_multaggr.c: branchruledata->ratioggain is allocated as block memory but is tried to be freed as normal memory (line 716) which results in an error.

Thanks. That will be fixed in the next release.

> Additionally I have a question about the use of SCIPallocBuffer. The documentation suggest, that buffer memory should only be used when the memory is allocated and freed in the same function. Thus I am wondering, why some structures have "constructors" that use Buffer memory instead of normal memory (e.g.  createConstantAssignment(), createNodedata(), createTcliqueGraph(), initializeMatrix()).

The "same function" may have been a bit simplified.
Maybe it should have rather been "same callback".
That is, at least for some callbacks, SCIP checks that no buffer memory 
is used after a plugins callback has been called.

createConstantAssignment() is a static function in reader_fzn that is 
called in the static function parseConstantArray(), which is called in 
the static function parseArray(), which is called in the static function 
readFZNFile(), which is called in the readerReadFzn() callback.
The buffer-memory allocated in createConstantAssignment() is freed 
before readerReadFzn() returns, since this is just memory that is used 
while reading the FlatZinc file.
I haven't looked at the other functions you mention, but presume that 
it's the same.

So, "buffer memory should only be used when the memory is allocated and 
freed in the same function" after unrolling all private (i.e., static) 
functions.

Stefan

> 
> 
> Best Regards,
> 
> Tony
> 
> A
> 
> 
> 
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip
> 



More information about the Scip mailing list