[GRASS-user] r.viewshed build

Glynn Clements glynn at gclements.plus.com
Mon Oct 10 03:51:37 EDT 2011


Adam Dershowitz, Ph.D., P.E. wrote:

> I just tried to build and run r.viewshed.  When I build it, it seems to
> compile fine, but then latter in the make process, I saw this error go
> past:
> 
> MM error: limit =0B. allocating 16B. limit exceeded by 24B.
> Assertion failed: (0), function operator new, file mm.cc, line 326.

> Any thoughts or suggestions what might be going on with this?

Something is trying to allocate memory before the memory manager
object has been initialised.

The order in which static objects are constructed is undefined. So if
a static object dynamically allocates memory in its constructor, it's
a matter of luck whether the memory manager object has been
constructed at that point.

Fortunately, the MM_register class doesn't actually need construction. 
Unfortunately, the limit-checking mode is statically initialised to
"abort", then changed to "ignore" in the constructor.

This has (hopefully) been fixed in 7.0 with r38702, but the problem
remains in 6.x.

The fix involves changing line 443 of lib/iostream/mm.cc from:

	MM_mode MM_register::register_new = MM_ABORT_ON_MEMORY_EXCEEDED; 
to:
	MM_mode MM_register::register_new = MM_IGNORE_MEMORY_EXCEEDED;

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


More information about the grass-user mailing list