[MacRuby-devel] Compilation Clarification

B. Ohr jazzbox at 7zz.de
Tue Jun 29 03:17:56 PDT 2010


Hi!

> 
> In the upcoming 0.7 release static compilation will be permitted, you will be able to generate a standalone binary that contains both the MacRuby runtime (some features disabled) and your application code, in about 1.5MB for regular-size apps.
> 

I tested that and it is looking great: only 1379704 bytes for my small app!

That size makes MacRuby really useable for Quicklook and Spotlight plugins. But what about garbage collection? 

If Macruby.sharedRuntime.evaluateString could use memory of an enclosing NSAutoreleasePool it would be very easy:


OSStatus GeneratePreviewForURL(void *thisInterface, QLPreviewRequestRef preview, 
    CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options)
{
  if (QLPreviewRequestIsCancelled(preview))
    return noErr;
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  …;
  NSMutableString* html = [[MacRuby sharedRuntime] evaluateString ….];
  QLPreviewRequestSetDataRepresentation(preview,
         (CFDataRef)[html dataUsingEncoding:NSUTF8StringEncoding], 
         kUTTypeHTML, (CFDictionaryRef)props);
  [pool release];
  return noErr;
}

- Bernd



More information about the MacRuby-devel mailing list