[sldev] Re: [VIEWER] 64 bit status and open source components (David Fries)

Dale Glass dale at daleglass.net
Fri Sep 14 07:38:12 PDT 2007


On Friday 14 September 2007 16:19:12 Argent Stonecutter wrote:
> If you fixed whatever was breaking the array delete, you probably
> ought to remove the comment. :)
>
> I don't grok C++ enough to know if you've just masked an underlying
> problem or fixed it, but I figure it'd be interesting and educational
> if you can elaborate on this particular patch. :)

My understanding (I'm not a C++ expert by any measure though) is that the 
difference between delete and delete[] is that there's no metadata that 
indicates whether there's an array there or not, so you've got to use the 
right form of delete.

For delete[] there would be a number of allocated elements somewhere. So 
using delete on an array probably deletes just the first element. A 
delete[] on something that isn't an array would result in reading some 
random number from where the array length should be, and deleting an 
arbitrary number of objects, very likely wreaking havoc.

Reasons for delete working on an array and delete[] crashing? My guess is 
delete doesn't crash because it does an incomplete deletion.

Maybe there's some memory corruption and it's not hitting it, or maybe the 
crash is in a destructor and it doesn't crash because it's not run.

So I think that the delete instead of delete[] was just masking some other 
problem, like memory corruption or a problem in the destructor.

I'd like to hear more info on this as well :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.secondlife.com/pipermail/sldev/attachments/20070914/855b1218/attachment.pgp


More information about the SLDev mailing list