[GRASS-dev] r.terraflow broken

Glynn Clements glynn at gclements.plus.com
Wed Aug 5 18:14:36 EDT 2009


Laura Toma wrote:

> The problem is that it attempts to set the memory manager limit to  0   
> (see below:  limit=0B), and the first line in
> MM_register::set_memory_limit(size_t new_limit)
> 
> is
> 
> assert(new_limit>0).
> 
> Therefore the problem.
> So the question is, why does it try to set  the memory limit to 0?
> Unless the user specifies a value, the default value is 300MB,  see  
> main.cc:
> 
> mem->answer="300";
> ...
> opt->mem = atoi(mem->answer);
> ..
> size_t mm_size = opt->mem << 20;    /* opt->mem is in MB */
> MM_manager.set_memory_limit(mm_size);

It doesn't even get as far as main(), let alone parsing and using the
mem= option:

$ gdb r.terraflow

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb6bcf9a0 (LWP 668)]
0xb7fd4424 in __kernel_vsyscall ()
> where
#0  0xb7fd4424 in __kernel_vsyscall ()
#1  0xb7d42311 in *__GI_raise (sig=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0xb7d43bf8 in *__GI_abort () at abort.c:88
#3  0xb7d3b6df in *__GI___assert_fail (
    assertion=0x6 <Address 0x6 out of bounds>, 
    file=0x6 <Address 0x6 out of bounds>, line=6, 
    function=0x80e3985 "void* operator new(size_t)") at assert.c:78
#4  0x080c8985 in operator new (sz=24) at mm.cc:344
#5  0xb6ec7c2f in global constructors keyed to _ZN4geos7ProfileC2ESs ()
    at ../util/Profiler.cpp:20
#6  0xb6ec8165 in __do_global_ctors_aux () from /usr/lib/libgeos.so.2
#7  0xb6e3a3c9 in _init () from /usr/lib/libgeos.so.2
#8  0xb7fe3a77 in call_init (l=0xb6ef3108, argc=2, argv=0xbfead4c4, 
    env=0xbfead4d0) at dl-init.c:70
#9  0xb7fe3b16 in _dl_init (main_map=0xb7ff2658, argc=2, argv=0xbfead4c4, 
    env=0xbfead4d0) at dl-init.c:134
#10 0xb7fd59df in _dl_start_user () from /lib/ld-linux.so.2

The assert is triggering in the constructor for a static variable
within the GEOS library (linked in by GDAL).

geos-2.2.3/source/util/Profiler.cpp has:

	static Profiler *internal_profiler = new Profiler();

This gets called before main(), but the customised "operator new()" in
lib/iostream doesn't work until the memory manager has been
initialised, which doesn't occur until G_parser() has been called.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list