[Qt-interest] glibc detected

Konrad Rosenbaum konrad at silmor.de
Mon Feb 23 07:54:52 CET 2009


On Monday 23 February 2009, Puneet Bisht wrote:
> *** glibc detected ***
> /home/mohit/Desktop/latest_codedGUI/codedGuiMerged_latestBackup/latestCod
>enew/latestCodenew: free(): invalid next size (fast): 0x0aee91b8 ***

Glibc, as any libc, keeps track of allocation information (ie. what chunk of 
memory is allocated to something and what chunk is still free). The 
information that links this information together is near the pointers that 
malloc and new return to you (to be precise: it is in front of the 
pointer). The message above comes if this information is corrupted.


a) you are freeing a pointer which has already been free'd or which is on an 
already invalid stack frame - check that each new is matched by exactly one 
delete, you don't need to free QObjects that have a parent (the parent will 
free them), make sure you don't hand pointers to temporary objects back as 
a return value from any function

b) you somehow managed to overwrite the allocation information - check that 
you never ever use negative indexes on arrays or pointers, check that you 
don't use indexes which are too large (and might overwrite the information 
on the next item)

c) you use the wrong de-allocation function: malloc/realloc must be matched 
with free, realloc must never be used on objects created with new, new must 
be matched with delete, new array[...] must be matched with delete[].


	good hunting,
	Konrad

-- 
Note: I'm changing my PGP/GPG key soon! New KeyID: 723A6200
Fingerprint: B37C FA75 8C4C 6537 7954  CBC0 CB15 C991 723A 6200
Keyserver: wwwkeys.eu.pgp.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090223/a0e30316/attachment.bin 


More information about the Qt-interest-old mailing list