Skip navigation.
 
mlRe: My bug or Apple's?
FROM : John Stiles
DATE : Sat Nov 20 07:28:42 2004

On Nov 19, 2004, at 7:29 PM, Ricky Sharp wrote:

> On Nov 19, 2004, at 5:04 PM, John Stiles wrote:
>

>> Well, as a matter of course, I try to release everything I allocate.
>> At my work, our allocator code will complain about a memory leak if I
>> don't.
>>
>> In this particular case, TSHashTables destroy each of their elements
>> when they are destroyed, because that's how they were designed.
>> Usually it's helpful. :)
>>
>> If I just wanted to leak the images, I could make my Image class'
>> destructor do nothing, but that seems like an error to me. Yes, in
>> this particular instance we're quitting anyway, so we don't HAVE to
>> free. But should I really need to make two separate types of Image
>> objects--one that frees itself on destruction, and one that
>> doesn't--just because of this bug? It doesn't seem logical to me.

>
> Is there any API in TSHashTables that you can call before static
> de-initialize time to release all the objects?  If so, just call that
> from say your delegate's applicationWillTerminate: method.


You know, I could, but TSHashTable is cross-platform code, and the PC
guys would throw a fit if I started adding in stuff like this.

In the end I'm happy with creating an autorelease pool around the
[myImage release]. It's really not that big a deal. I just wanted to
know if it was my bug or not. I'm still not 100% sure, to be honest--I
definitely get the impression that Apple WANTS me to do things a
different way, since the system was designed around using the
Objective-C messages for detecting application termination and not the
C++ way. But nobody's come out and said "this is your bug" or "this is
a Cocoa limitation that we may or may not fix," etc. Since Apple is
trying to show that Objective-C++ is a good solution for developers
with cross-platform code, maybe they should make the atexit time more
Objective-C savvy, but it's not a huge deal either way.

Related mailsAuthorDate
mlMy bug or Apple's? John Stiles Nov 12, 03:49
mlRe: My bug or Apple's? Nick Zitzmann Nov 12, 05:20
mlRe: My bug or Apple's? Günther Blaschek Nov 12, 12:32
mlRe: My bug or Apple's? John Stiles Nov 12, 16:00
mlRe: My bug or Apple's? Shawn Erickson Nov 12, 18:20
mlRe: My bug or Apple's? Bob Ippolito Nov 12, 18:24
mlRe: My bug or Apple's? John Stiles Nov 12, 20:11
mlRe: My bug or Apple's? John Stiles Nov 12, 20:32
mlRe: My bug or Apple's? John C. Randolph Nov 19, 23:54
mlRe: My bug or Apple's? John C. Randolph Nov 19, 23:56
mlRe: My bug or Apple's? John Stiles Nov 19, 23:59
mlRe: My bug or Apple's? John Stiles Nov 20, 00:04
mlRe: My bug or Apple's? Ricky Sharp Nov 20, 04:29
mlRe: My bug or Apple's? John Stiles Nov 20, 07:28