• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
I don't understand why this is leaking...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I don't understand why this is leaking...


  • Subject: I don't understand why this is leaking...
  • From: Klaus Backert <email@hidden>
  • Date: Tue, 12 Aug 2008 20:13:35 +0200


Am 12.08.2008 um 19:05 schrieb Jason Coco:

On Aug 12, 2008, at 12:50 , Klaus Backert wrote:

About $Null:

It it were a reserved word, it would be documented so.


The "Archives and Serializations Programming Guide for Cocoa" says:

Keyed Archives
...
Naming Values
...
You should avoid using “$” as a prefix for your keys. The keyed archiver and unarchiver use keys prefixed with “$” for internal values. Although they test for and mangle user-defined keys that have a “$” prefix, this overhead slows down archiving performance.
...

In this case, however, it's the actual value being encoded... not the key name. Also, if you read it, it suggests that you shouldn't use it for performance reasons. It specifically states that it is supposed to properly mangle the $ in a key name (causing the performance loss)...

That's right. Sorry, I confused this. But talking about ... I read nothing in the documentation what using $-prefixed *keys* for internal values *exactly* does. It improves performance, okay, but it can be anything else, and a different thing tomorrow. I handle this "implementation detail" in the usual way. I will stay away from $- prefixed keys.


Back to $-prefixed *values*:

Gerriet Denkmann already realized something – which is not documented, as far as I know. A keyed archive contains a $object array, and the element $object[0] has the value $null. Implementation detail!

I performed a test with my current project. I changed a certain value of a string variable to $null, saved it as a keyed archive in binary property list format – with the $null value anywhere in the "middle" –, opened the saved archive in a new document, and ...

***crash***:

2008-08-12 20:04:58.549 Blotto[24783] NSExceptionHandler has recorded the following exception:
NSInvalidArgumentException -- *** -[NSPlaceholderDictionary initWithObjects:forKeys:]: number of objects (0) not equal to number of keys (21)
Stack trace: 0x966eaf10 0x92c10e0c 0x92c552a0 0x92c18fc8 0x92bfaea4 0x92bfa688 0x00007bd8 0x92bfaea4 0x92bfa688 0x0001840c 0x000160e8 0x93ac6344 0x00012acc 0x939504a8 0x00012e20 0x93ac5634 0x9394f960 0x93acc1fc 0x93acc03c 0x93acbec0 0x938358b4 0x93890094 0x9388fe18 0x9388f8c0 0x9388f50c 0x93799058 0x93790960 0x93881458 0x00004334 0x00003258 0x00002f5c 0x00001000
2008-08-12 20:04:58.550 Blotto[24783] NSExceptionHandler will now suspend the current thread and wait for debugger attachment
_NSExceptionHandlerExceptionRaiser (in ExceptionHandling)
+[NSException raise:format:] (in Foundation)
-[NSDictionary initWithObjects:forKeys:] (in Foundation)
-[NSDictionary initWithCoder:] (in Foundation)
__decodeObjectBinary (in Foundation)
__decodeObject (in Foundation)
-[BloWorld initWithCoder:] (in Blotto)
__decodeObjectBinary (in Foundation)
__decodeObject (in Foundation)
-[BloDocument readPListFromData:error:] (in Blotto)
-[BloDocument readFromData:ofType:error:] (in Blotto)
-[NSDocument readFromFileWrapper:ofType:error:] (in AppKit)
-[YetDocument readFromFileWrapper:ofType:error:] (in Blotto) (YetDocument.m:153)
-[NSDocument readFromURL:ofType:error:] (in AppKit)
-[YetDocument readFromURL:ofType:error:] (in Blotto) (YetDocument.m:172)
-[NSDocument _initWithContentsOfURL:ofType:error:] (in AppKit)
-[NSDocument initWithContentsOfURL:ofType:error:] (in AppKit)
-[NSDocumentController makeDocumentWithContentsOfURL:ofType:error:] (in AppKit)
-[NSDocumentController openDocumentWithContentsOfURL:display:error:] (in AppKit)
-[NSDocumentController openDocument:] (in AppKit)
-[NSApplication sendAction:to:from:] (in AppKit)
-[NSMenu performActionForItemAtIndex:] (in AppKit)
-[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] (in AppKit)
-[NSMenu performKeyEquivalent:] (in AppKit)
-[NSApplication _handleKeyEquivalent:] (in AppKit)
-[NSApplication sendEvent:] (in AppKit)
-[NSApplication run] (in AppKit)
_NSApplicationMain (in AppKit)
_main (in Blotto) (main.m:10)
__start (in Blotto)
start (in Blotto)
0x00001000 (in Blotto)


q.e.d.

Greetings
Klaus

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: I don't understand why this is leaking... (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: I don't understand why this is leaking... (From: Graham Cox <email@hidden>)
 >Re: I don't understand why this is leaking... (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: I don't understand why this is leaking... (From: Graham Cox <email@hidden>)
 >Re: I don't understand why this is leaking... (From: "Gerriet M. Denkmann" <email@hidden>)
 >I don't understand why this is leaking... (From: Klaus Backert <email@hidden>)
 >Re: I don't understand why this is leaking... (From: Jason Coco <email@hidden>)

  • Prev by Date: Re: Opening an external file in a external application
  • Next by Date: Re: Get specified window from nib
  • Previous by thread: Re: I don't understand why this is leaking...
  • Next by thread: Re: I don't understand why this is leaking...
  • Index(es):
    • Date
    • Thread