[Openmcl-devel] release/autorelease question

R. Matthew Emerson rme at clozure.com
Tue May 4 18:52:22 PDT 2010


On May 4, 2010, at 8:25 PM, John DeSoi wrote:

> I was looking at gui::lookup-hyperspec-symbol and noticed a couple of calls to %make-nsstring that do not appear to be released or autoreleased. Is this a memory leak or do I still not completely get Cocoa memory management? I think both cases are equally likely :).
> 
> Thanks,
> 
> John
> 
> ====
> 
> 
> (defun lookup-hyperspec-symbol (symbol doc)
>  (let* ((relative-url (gethash symbol (hyperspec-map-hash doc))))
>    (when relative-url
>      (let* ((url (#/absoluteURL
>                   (make-instance 'ns:ns-url
>                                  :with-string (%make-nsstring relative-url)
>                                  :relative-to-url *hyperspec-map-sym-url*))))
> ....
> 

You are right.  That function leaks not only NSString instances (as returned by %make-nsstring), but also the NSURL object, the NSData object, and the NSAttributedString object that contains the returned HTML.

That function could use some help. :-)





More information about the Openmcl-devel mailing list