[Openmcl-devel] Allocating temporary nsstrings

Ron Garret ron at flownet.com
Sun Mar 13 20:31:23 UTC 2011


On Mar 13, 2011, at 7:50 AM, Paul Krueger wrote:

> It's never been entirely clear to me exactly how these Objective C class constructors are implemented. Do they re-use memory from some pool or just return an autoreleased object?

Empirically it seems they are allocated in the current thread's autorelease pool.  So they go away when the current thread terminates.

Welcome to Clozure Common Lisp Version 1.7-dev-r14674M-trunk  (DarwinX8664)!
? (setf s (with-encoded-cstrs :utf-8 ((s "foo"))
      (#/stringWithUTF8String: ns:ns-string s)))
#<NS-MUTABLE-STRING "foo" (#x5E1DF0)>
? s
#<NS-MUTABLE-STRING "foo" (#x5E1DF0)>
? 

Now close that listener and open another one:

Welcome to Clozure Common Lisp Version 1.7-dev-r14674M-trunk  (DarwinX8664)!
? s
#<Bogus ObjC Object #x5E1DF0>
? 

rg





More information about the Openmcl-devel mailing list