[gecode-users] compiler memory problem

Tias Guns tias.guns at cs.kuleuven.be
Thu Nov 20 10:31:58 CET 2008


I'm running gcc 4.1.3 and the code provided compiles and runs without  
problems. Maybe check the compile flags used (like -finline-limit=3000),  
those are the same flags as used for the examples (at least in version  


[tias at demerzel]test make
g++ /home/tias/local/src/gecode-2.2.0/examples/support/options.o  
/home/tias/local/src/gecode-2.2.0/examples/support/example.o -L.  
-L/home/tias/local/src/gecode-2.2.0 -I.  
-I/home/tias/local/src/gecode-2.2.0 -DNDEBUG -fvisibility=hidden -fPIC  
-Wextra -Wall -pipe -ggdb -O3 -fno-strict-aliasing -finline-limit=3000  
-ffast-math -mtune=i686 -lgecodesearch -lgecodeint -lgecodekernel  
-lgecodesupport -lgecodegist     test.cc   -o test
test.cc:51: warning: unused parameter ‘home’
test.cc:51: warning: unused parameter ‘med’
test.cc:87: warning: unused parameter ‘argc’
test.cc:87: warning: unused parameter ‘argv’
[tias at demerzel]test ls
Makefile  test*  test.cc
[tias at demerzel]test ./test
[tias at demerzel]test gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v  
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr  
--enable-shared --with-system-zlib --libexecdir=/usr/lib  
--without-included-gettext --enable-threads=posix --enable-nls  
--with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1  
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug  
--enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
[tias at demerzel]test

On Thu, 20 Nov 2008 09:45:25 +0100, Christian Schulte <cschulte at kth.se>  

> Hi Patrik,
> Going by your example code, this should very definitely not pose any  
> problem, Gecode itself uses way more elaborate constructions with  
> patterns.
> One reason for the problem could be the part you do not tell us: if you  
> have code that uses a lot of inlining, then that could be a problem.
> Otherwise, that particular version of gcc might be at fault. As I do not  
> use gcc that much I don't know whether this version is a bad one.
> Cheers
> Christian
> --
> Christian Schulte, www.ict.kth.se/~cschulte/
> -----Original Message-----
> From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On  
> Behalf Of Patrik Haslum
> Sent: Thursday, November 20, 2008 9:26 AM
> To: users at gecode.org
> Subject: [gecode-users] compiler memory problem
> Hi,
> I've written a custom propagator. It is based on one of the existing  
> templates, Gecode:BinaryPropagator, with an array of boolean views as  
> the template argument. It works, but the compiler (g++ 4.1.2) is having  
> serious trouble with the code: if I try to use any compiler optimisation  
> (that is, anything other than -O0), the compiler eats up all memory  
> (including swap) and never finishes. I know that using many and/or  
> nested templates tends to increase compiler memory use, but this case is  
> worse than anything I've encountered before. Is this a known problem?
> (perhaps fixed in some more recent g++ compiler). Is there some way to  
> work around it? (other than disabling compiler optimisation, because  
> that *really* slows down the solver). The only other option I can think  
> of is to write the propagator from scratch, without relying on any base  
> template.
> Attached is a simplified version of the code (it doesn't contain any  
> actual functionality, just the minimum that is needed to cause the  
> compiler to behave this way).
> Thanks,
> 			/P at trik
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users

More information about the gecode-users mailing list