[GRASS-dev] Re: [GRASS GIS] #111: r.los fails in WinGRASS with high
values for max_dis parameter
GRASS GIS
trac at osgeo.org
Sat Feb 28 21:16:26 EST 2009
#111: r.los fails in WinGRASS with high values for max_dis parameter
---------------------------+------------------------------------------------
Reporter: gsancho | Owner: grass-dev at lists.osgeo.org
Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Raster | Version: svn-develbranch6
Resolution: | Keywords: wingrass r.los
Platform: MSWindows XP | Cpu: x86-32
---------------------------+------------------------------------------------
Comment (by hamish):
another report of it:
http://lists.osgeo.org/pipermail/grass-windows/2008-November/001587.html
----
Benjamin Ducke wrote on the -dev list:
{{{
Michael,
this is a problem with dirty memory allocation that never got fixed.
On some systems, like Linux, the memory manager is a bit more "relaxed"
and lets this pass. On Windows, it's more strict and kills
the application. The crashes appear a bit random which is typical for
memory allocation problems. The more allocations involved (read: the
bigger
you set max_dist), the more probable it becomes that a sensitive memory
region gets corrupted and the program bails out.
If anyone wants to have a go at it: use Valgrind on Linux. It will tell
you exactly where the bad allocations happen. I actually had a go at this
years ago and it was quite easy to fix, but lost my notes in the meantime.
From memory: the problem can be fixed by delaying the release of memory
allocated at the start of each run through the main loop.
I have attached a file "delete3.c" from r.cva for which I fixed the same
problem.
I believe this file is identical to the version that r.los uses except for
the
changes I made. Look for the string "DELAYED". You should find my comments
and
additions. Replicate them for r.los and you _should_ be OK (provided there
were
no substantial changes to r.los since I wrote my fixed).
In main.c, the following has to be added towards the top of the file:
if (G_parser (argc, argv))
exit(EXIT_FAILURE);
G_sleep_on_error (0);
/* initialize delayed point deletion */
DELAYED_DELETE = NULL;
And this toward the end:
/* release that last tiny bit of memory ... */
if ( DELAYED_DELETE != NULL ) {
G_free ( DELAYED_DELETE );
}
return (0);
}
Unfortunately, I don't have the time to look into this myself at the
moment.
Sorry for not being of more help. This is a long-standing, very annoying
issue
that needs fixing urgently. It's embarassing to have such a basic tool
fail in
this way.
Cheers,
Ben
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/111#comment:8>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list