Projects

Ticket #724 (closed defect: invalid)

Opened 21 months ago

Last modified 21 months ago

malloc warning with bookmarkDataWithContentsOfURL on aliases

Reported by: tvmoore@… Owned by: lsansonetti@…
Priority: minor Milestone: MacRuby 0.6
Component: MacRuby Keywords:
Cc:

Description (last modified by martinlagardette@…) (diff)

Create a Mac OS alias (not a symbolic link) named test on the Desktop, run the following script:

framework 'cocoa'

p = NSURL.fileURLWithPath(File.expand_path("~/Desktop/test"))
data = NSURL.bookmarkDataWithContentsOfURL(p, error:nil)

It will result in this warning:

macruby(420,0x7fff70770be0) malloc: reference count underflow for 0x2004b9800, break on auto_refcount_underflow_error to debug.

Change History

Changed 21 months ago by martinlagardette@…

Hi!

I can't reproduce this on my machine... Can you reproduce it each time you run this script?

Changed 21 months ago by martinlagardette@…

  • description modified (diff)
  • summary changed from malloc warning to malloc warning with bookmarkDataWithContentsOfURL on aliases

Changed 21 months ago by martinlagardette@…

Breakpoint 1, 0x00007fff8523dc34 in auto_refcount_underflow_error ()
(gdb) bt
#0  0x00007fff8523dc34 in auto_refcount_underflow_error ()
#1  0x00007fff8524ac71 in Auto::Zone::dec_refcount_small_medium ()
#2  0x00007fff8524c75e in Auto::Zone::block_decrement_refcount ()
#3  0x00007fff85235a0f in auto_zone_release ()
#4  0x00007fff82eaf756 in _CFRelease ()
#5  0x00007fff88966ec0 in _CFURLCreateBookmarkDataFromFile ()
#6  0x00007fff82fbf858 in +[NSURL bookmarkDataWithContentsOfURL:error:] ()
#7  0x000000010110071c in ?? ()
#8  0x00000001001364e5 in __rb_vm_dispatch [inlined] () at /Users/naixn/Documents/Projets/MacRuby/dispatcher.cpp:450
#9  0x00000001001364e5 in rb_vm_dispatch () at dispatcher.cpp:1061
#10 0x00000001011002c2 in ?? ()
#11 0x0000000100154c8d in rb_vm_run (fname=0x2000d69e0 "/Users/naixn/Desktop/test.rb", node=0x2000d9500, binding=0x0, inside_eval=false) at vm.cpp:3708
#12 0x000000010003f6f1 in ruby_run_node (n=0x2000d9500) at eval.c:202
#13 0x0000000100000c15 in main (argc=2, argv=0x100f1cba0, envp=0x7fff5fbff7f0) at main.cpp:40
(gdb) 

Changed 21 months ago by martinlagardette@…

  • status changed from new to closed
  • resolution set to invalid

This is a bug in the OS actually:

$> cat t.m
#import <Foundation/Foundation.h>

int main(void)
{
    NSURL *url = [NSURL fileURLWithPath:@"/tmp/test"];
    NSData *data = [NSURL bookmarkDataWithContentsOfURL:url error:nil];
    printf("-> %p\n", data);
    return 0;
}
$> gcc /tmp/t.m -o /tmp/t -framework Foundation -fobjc-gc
$> ./t

t(61211,0x7fff70982be0) malloc: reference count underflow for 0x20000f580, break on auto_refcount_underflow_error to debug.
-> 0x20000f540
$>

Well I say bug, but it's just a simple warning. It has been reported anyway :-).

Note: See TracTickets for help on using tickets.