Article View: comp.sys.mac.programmer.misc
Article #12Re: Help requested: QuickTime Player quits unexpectedly
From: No Body
Date: Sun, 26 May 2002 23:05
Date: Sun, 26 May 2002 23:05
43 lines
2876 bytes
2876 bytes
> *** malloc[278]: Deallocation of a pointer not malloced: 0xffffffff; > This could be a double free(), or free() called with the middle of an > allocated block; Try setting environment variable MallocHelp to see > tools to help debug I've seen this a lot, but not on 10.1.x. I'm using 10.0.4 and I see this whenever I try to free() a piece of memory that I've malloc()ed. What I would do would be something like: int *ptr1, *ptr2; ptr1 = (char *)malloc( 100 * sizeof( int ) ); ptr2 = (char *)malloc( 200 * sizeof( int ) ); Now this would work alright until I freed one and tried to access the other as in: free( ptr1 ); ptr2[1] = 10; // your error appears at this point This drove me crazy for a while and so I tried C++ new and delete and that worked without problem, and I could allocate and dealloc memory at will. I looked into this some more just recently and I've noticed that this malloc problem goes away if you type cast when passing to free. I can't remember too well how it went but whenever you free()ed memory you needed to typecast in the following way: free( (void *)ptr1 ); ptr2[123] = 11; // this now works I can't remember the cast exactly (it might be (char *) now that I think of it) but the fix to a bug that reports this error can be done in this way. Weird that this bug is still in 10.1.x. I thought only oldies like myself had to suffer this. Don't know if that helps, Andrew
Technical Details
Message-ID:
<noone-8EF7B7.09051827052002@lust.ihug.co.nz>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!cox.net!nntp-relay.ihug.net!lust.ihug.co.nz!ihug.co.nz!nooneReferences:
<1fcscd6.1b0vxlo1msb0doN%PeWi@apple.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 101ec9,933af84addf31fa3 X-Google-Attributes: gid101ec9,public X-Google-Thread: 10e148,933af84addf31fa3 X-Google-Attributes: gid10e148,public X-Google-Thread: 1123d2,933af84addf31fa3 X-Google-Attributes: gid1123d2,public X-Google-Thread: 1156c9,933af84addf31fa3 X-Google-Attributes: gid1156c9,public X-Google-Thread: fc20b,933af84addf31fa3 X-Google-Attributes: gidfc20b,public X-Google-Thread: fed41,933af84addf31fa3 X-Google-Attributes: gidfed41,public X-Google-ArrivalTime: 2002-05-26 16:03:45 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!cox.net!nntp-relay.ihug.net!lust.ihug.co.nz!ihug.co.nz!noone From: No Body <noone@no.where> Newsgroups: comp.sys.mac.programmer.misc,comp.sys.mac.programmer.help,comp.sys.mac.misc,comp.sys.mac.system,be.comp.sys.mac,uk.comp.sys.mac Subject: Re: Help requested: QuickTime Player quits unexpectedly Date: Mon, 27 May 2002 09:05:18 +1000 Organization: ihug ( New Zealand ) Lines: 43 Message-ID: <noone-8EF7B7.09051827052002@lust.ihug.co.nz> References: <1fcscd6.1b0vxlo1msb0doN%PeWi@apple.com> NNTP-Posting-Host: p247-tnt3.syd.ihug.com.au X-Trace: lust.ihug.co.nz 1022454222 11295 203.173.132.247 (26 May 2002 23:03:42 GMT) X-Complaints-To: abuse@ihug.co.nz NNTP-Posting-Date: Sun, 26 May 2002 23:03:42 +0000 (UTC) User-Agent: MT-NewsWatcher/3.1 (PPC)