[Openmcl-devel] Determining OSX version at runtime
Paul Krueger
plkrueger at comcast.net
Fri Aug 27 08:13:03 PDT 2010
Hmmm... I would have assumed that like most objects returned by functions you would have needed to explicitly #/retain the NSArray returned by #/allFrameworks if you wanted to keep it around and shouldn't need to worry about releasing it in this case. The strings in the array are retained by the array of course, but should be released when the NSArray is reclaimed. Did I misunderstand something here?
Paul
On Aug 27, 2010, at 9:22 AM, Raffael Cavallaro wrote:
>
> On Aug 27, 2010, at 10:12 AM, Raffael Cavallaro wrote:
>
>> (defun framework-loaded-p (framework-namestring) ;; case sensitive
>> (let* ((frameworks (#/allFrameworks ns:ns-bundle)))
>> (loop for i below (#/count frameworks)
>> for current-framework = (ccl::lisp-string-from-nsstring
>> (#/bundleIdentifier (#/objectAtIndex: frameworks i)))
>> when (search framework-namestring current-framework)
>> return current-framework)))
>
> probably want to do that in an autorelease pool so we don't leak an NSArray and a bunch of NSStrings:
>
> (defun framework-loaded-p (framework-namestring) ;; case sensitive
> (ccl::with-autorelease-pool
> (let* ((frameworks (#/allFrameworks ns:ns-bundle)))
> (loop for i below (#/count frameworks)
> for current-framework = (ccl::lisp-string-from-nsstring
> (#/bundleIdentifier (#/objectAtIndex: frameworks i)))
> when (search framework-namestring current-framework)
> return current-framework))))
>
> warmest regards,
>
> Ralph
>
>
> Raffael Cavallaro
> raffaelcavallaro at me.com
>
>
>
>
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
More information about the Openmcl-devel
mailing list