Can we just initialize the MM_manager to ignore memory limits until we have a chance <br>to set and enforce a limit? The change below allowed me to at least compile and run the help<br><br>--- lib/iostream/mm.cc (revision 38633)<br>
+++ lib/iostream/mm.cc (working copy)<br>@@ -458,7 +458,7 @@<br> MM_register MM_manager;<br> int MM_register::instances = 0; // Number of instances. (init)<br> // TPIE's "register memory requests" flag<br>
-MM_mode MM_register::register_new = MM_ABORT_ON_MEMORY_EXCEEDED; <br>+MM_mode MM_register::register_new = MM_IGNORE_MEMORY_EXCEEDED; <br><br><div class="gmail_quote">On Wed, Aug 5, 2009 at 6:14 PM, Glynn Clements <span dir="ltr"><<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
Laura Toma wrote:<br>
<br>
> The problem is that it attempts to set the memory manager limit to 0<br>
> (see below: limit=0B), and the first line in<br>
> MM_register::set_memory_limit(size_t new_limit)<br>
><br>
> is<br>
><br>
> assert(new_limit>0).<br>
><br>
> Therefore the problem.<br>
> So the question is, why does it try to set the memory limit to 0?<br>
> Unless the user specifies a value, the default value is 300MB, see<br>
> main.cc:<br>
><br>
> mem->answer="300";<br>
> ...<br>
> opt->mem = atoi(mem->answer);<br>
> ..<br>
> size_t mm_size = opt->mem << 20; /* opt->mem is in MB */<br>
> MM_manager.set_memory_limit(mm_size);<br>
<br>
</div>It doesn't even get as far as main(), let alone parsing and using the<br>
mem= option:<br>
<br>
$ gdb r.terraflow<br>
<br>
Program received signal SIGABRT, Aborted.<br>
[Switching to Thread 0xb6bcf9a0 (LWP 668)]<br>
0xb7fd4424 in __kernel_vsyscall ()<br>
> where<br>
#0 0xb7fd4424 in __kernel_vsyscall ()<br>
#1 0xb7d42311 in *__GI_raise (sig=6)<br>
at ../nptl/sysdeps/unix/sysv/linux/raise.c:64<br>
#2 0xb7d43bf8 in *__GI_abort () at abort.c:88<br>
#3 0xb7d3b6df in *__GI___assert_fail (<br>
assertion=0x6 <Address 0x6 out of bounds>,<br>
file=0x6 <Address 0x6 out of bounds>, line=6,<br>
function=0x80e3985 "void* operator new(size_t)") at assert.c:78<br>
#4 0x080c8985 in operator new (sz=24) at mm.cc:344<br>
#5 0xb6ec7c2f in global constructors keyed to _ZN4geos7ProfileC2ESs ()<br>
at ../util/Profiler.cpp:20<br>
#6 0xb6ec8165 in __do_global_ctors_aux () from /usr/lib/libgeos.so.2<br>
#7 0xb6e3a3c9 in _init () from /usr/lib/libgeos.so.2<br>
#8 0xb7fe3a77 in call_init (l=0xb6ef3108, argc=2, argv=0xbfead4c4,<br>
env=0xbfead4d0) at dl-init.c:70<br>
#9 0xb7fe3b16 in _dl_init (main_map=0xb7ff2658, argc=2, argv=0xbfead4c4,<br>
env=0xbfead4d0) at dl-init.c:134<br>
#10 0xb7fd59df in _dl_start_user () from /lib/ld-linux.so.2<br>
<br>
The assert is triggering in the constructor for a static variable<br>
within the GEOS library (linked in by GDAL).<br>
<br>
geos-2.2.3/source/util/Profiler.cpp has:<br>
<br>
static Profiler *internal_profiler = new Profiler();<br>
<br>
This gets called before main(), but the customised "operator new()" in<br>
lib/iostream doesn't work until the memory manager has been<br>
initialised, which doesn't occur until G_parser() has been called.<br>
<font color="#888888"><br>
--<br>
</font><div class="im">Glynn Clements <<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>><br>
</div><div><div></div><div class="h5">_______________________________________________<br>
grass-dev mailing list<br>
<a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-dev</a><br>
<br>
</div></div></blockquote></div><br>