[GRASS-dev] r.los on windows question

Benjamin Ducke benjamin.ducke at oxfordarch.co.uk
Fri Feb 27 04:27:15 EST 2009


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

----- Original Message -----
From: "Michael Barton" <Michael.Barton at asu.edu>
To: "developers grass" <grass-dev at lists.osgeo.org>
Sent: Thursday, February 26, 2009 9:20:10 PM GMT +00:00 GMT Britain, 
Ireland, Portugal
Subject: [GRASS-dev] r.los on windows question

Just ran into an issue in the OSGeo4W version of GRASS that I had
originally hit in 6.3 and subsequently forgotten about. I wonder if
anyone else has experienced this.

r.los with crash with a restart message in Windows XP if the max_dist
is too large. In the current case, even 9000 (9km) is too large.
Sometimes it works and sometimes it crashes.

Does anyone have any information about this?

Michael
_______________________________________________
grass-dev mailing list
grass-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev





------
Files attached to this email may be in ISO 26300 format (OASIS Open Document Format). If you have difficulty opening them, please visit http://iso26300.info for more information.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: delete3.c
Type: text/x-csrc
Size: 3594 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20090227/14f846f3/delete3.bin


More information about the grass-dev mailing list