[GRASS5] i.points and i.rectify: glibc detected/corruption

Wolf Bergenheim wolf+grass at bergenheim.net
Mon Nov 28 13:53:46 EST 2005


On 28/11/05 17:50, Markus Neteler wrote:
> Hi,
> 
> in both i.points and i.rectify we get ugly
> *** glibc detected *** double free or corruption
> 

Ah yes. that is is nasty. it means that we are calling free on a pointer
allready freed, or free on something that does npt point anywhere. I.e
random.

I ran into this today at work, and there it was casied by having a
string in 2 structures, but the string pointer was copied to the second
struct, instead of, say, strdup. The program would crash whenever both
structures were freed.

> 
> In the fcb section something happens which is called by G_close_cell().
> Strangly, it works for the first maps.
> 
> How to debug this?

Enable coredumps, and then run i.rectify again (make sure you have
compiuled with -g (which you seem to have done) and then dump a the
callstack in "gdb i.rectify core" with the "bt" command.

This should give you the callstack, and you can thene see what is being
freed. Then you can try to find in the code or with a debugger if a
pointer to this meory location is copied or something.

Also if you are running on linux (intel cpu) you can also try if
valgrind is of any help.

--Wolf

-- 

<:3 )---- Wolf Bergenheim ----( 8:>




More information about the grass-dev mailing list