help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: double free or corruption - it works on older machine


From: Ulrich Eckhardt
Subject: Re: double free or corruption - it works on older machine
Date: Wed, 16 Aug 2006 19:10:13 +0200
User-agent: KNode/0.10.2

alan.larkin@gmail.com wrote:
> I have software that works on an old machine:
> Linux 2.4.20-8smp #1 SMP i686 i686 i386 GNU/Linux
> gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
> 
> But not on a new one:
> Linux 2.6.15-26-amd64-generic #1 SMP PREEMPT x86_64 GNU/Linux
> gcc (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
> (also has gcc 3.3 and 3.4)

Those numbers are mostly irrelevant, the question rather is which
malloc/free implementations you use. You might be able to reproduce the
error on the older system by upgrading the glibc.

> I get a "*** glibc detected *** double free or corruption (!prev):
> 0x00002aaabc610420 ***" error which IMHO is a scurrilous lie ... I dont
> see anything wrong with the code which has been working for a long
> time.

Hahahaa. Believe me, we all had cases where we would have sworn that the
code is okay but it wasn't. Show the code first. Also, does it compile
without warnings and does it follow guidelines for safe, modern C++?

> Things are greatly complicated by the fact that the new machine is
> AMD64, this software is a plugin loaded dynamically by (Sun) java so
> gdb isnt an option I dont think, and that I am stuck with java version
> 1.5.

Why not? Of course you can attach GDB to a process while it's running. BTW,
just to name an example, in C you can get away without a malloc()
declaration and still use it as long as a pointer has the same size as an
int, while this is sure to break on e.g. 64 bit machines. Similar
assumptions about the size of types have proven fatal to other programs,
too which then broke as soon as someone put them on a 64 bit system.

Uli

-- 
http://gcc.gnu.org/faq.html
http://parashift.com/c++-faq-lite/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]