silly debugging question

DTAshley at aol.com DTAshley at aol.com
Tue Apr 13 17:13:10 CEST 2004


Hi Nathan,

I can't give you advice about gdb, but your program (based on the error 
messages) may be failing to [re]initialize something, perhaps after the item was 
destroyed.

The error:

*** malloc[1043]: error for object 0xbffdee80: Pointer being 
reallocated was not allocated

is logically very serious.  I believe it indicates that a call to realloc() 
or friends is using a pointer that was not obtained by a call to malloc() and 
friends.  Assuming that the error is not in the GMP, this would imply that your 
program is using something before initializing it or after it was destroyed 
but before reinitializaing it.

A second possibility is that you have an oddball version of realloc().  I 
believe realloc() is required to treat a NULL pointer as a malloc(), and 
something may be going wrong there.

I hope that others can give you specific advice about gdb.  The most likely 
cause is your program.

Dave

In a message dated 4/13/2004 3:23:47 AM Eastern Daylight Time, 
nmoore at physics.umn.edu writes:


> Of late I've run into a malloc error in a c++ program using the gmp 
> library.  Specifically, the program gives error,
> 
> *** malloc[1043]: error for object 0xbffdee80: Pointer being 
> reallocated was not allocated
> GNU MP: Cannot reallocate memory (old_size=4294425088 new_size=4)
> 
> or when run again
> 
> *** malloc[1047]: error for object 0x2: Pointer being reallocated was 
> not allocated
> GNU MP: Cannot reallocate memory (old_size=4294425088 new_size=8)
> 
> Is the system simply running out of memory?  In each (and almost every) 
> case the program "Abort"s immediately afterward.  The code as presently 
> written manipulates rational numbers, (mpq_t) a number of times.
> 
> I was trying to use gdb to find the line where the program failed 
> earlier this evening, but the syntax seems more cryptic that dbx.  
> Realize its unrelated, but would none-the-less appreciate (if its easy 
> to explain) a description of the easiest way to give the line at which 
> the code fails from the gnu debugger, gdb.
> 
> 
> regards,
> 
> Nathan Moore
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /list-archives/gmp-discuss/attachments/20040413/1e827a5c/attachment.htm


More information about the gmp-discuss mailing list