On Jan 27, 2007, at 11:02 AM, Aliacta wrote:

I'm trying to implement Spotlight through declares but I have a memory leak with every query I launch.

AFAIK I declare only one function that allocates memory hence I presume that should be the only one to release. When I try to release it however, my application just crashes.

Here's the function that allocates memory:

  MDQueryRef MDQueryCreate (
  CFAllocatorRef allocator,
  CFStringRef queryString,
  CFArrayRef valueListAttrs,
  CFArrayRef sortingAttrs
  );

After I execute the query and store its results, I'm done with it and want to release the memory:

  CFRelease MDQueryRef

This gives a hard crash.

If anybody can give me any clue, like do I release it too soon, do I have to do something else to release it, are there some dependencies I'm not aware of, etc.


This looks like it should work. A correct declaration for CFRelease is the following.

soft declare sub CFRelease lib "Carbon.framework" (cf as Integer)

CFRelease does not like being passed a null pointer, so that's the first thing I suggest checking.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to