Note that there are some explanatory texts on larger screens.

plurals
  1. POcocoa 64bit binaries leak memory? (releasing NSData does not free memory)
    primarykey
    data
    text
    <p>i've been playing some time with different builds of my application and there seem strange things to happen:</p> <p>my app has a 5mb idle footprint. when uploading a file memory in size of the file is reserved. after the upload the reserved memory should be freed. now there are differences in the builds (gc = garbage collector):</p> <ul> <li>32bit i386 no-GC: all memory is freed instantly.</li> <li>32bit i386 GC: almost all memory is freed instantly. the rest some time later.</li> <li>64bit x86_64 no-GC: minimal memory is freed. like 10%</li> <li>64bit x86_64 GC: no memory at all is freed. the memory stays reserved for hours. (activity mon)</li> </ul> <p>i'm using LLVM with CLANG. i have been running today instruments all the time and was checking for leaks/zombies/etc. and everything seems to be clean. (the app is rather simple.)</p> <p>is there an explanation for this behavior?</p> <hr> <p>Update:</p> <p>That's some weird stuff. I've boiled the problem to this:</p> <p>I load a 20mb file into a NSData and release it. I'm doing this without any garbage collection enabled. The code is:</p> <pre><code>NSData *bla = [[NSData alloc] initWithContentsOfFile:@"/bigshit"]; [bla release]; </code></pre> <p>When I build for i386 32bit the 20mb are allocated and released. When I switch the build to 64bit x86_64 the release does nothing. The 20mb stay allocated.</p> <p><a href="http://kttns.org/zguxn">upper pic 32bit lower 64 http://kttns.org/zguxn</a></p> <p>There is no difference between the two apps except that the upper one is built for 32bit and the lower one 64bit. There is no GC running. (With GC enabled the same problem appears.)</p> <hr> <p>Update 2: </p> <p>The Same behavior can be observed when I create a new cocoa app from scratch with only the upper code in applicationDidFinishLaunching:. In 64bit mode the memory is not released. i386 works as expected.</p> <p>The same problem appears with NSString instead of NSData. It also appears when I boot the 64bit kernel. (Holding 64 at startup.)</p> <p>OS is 10.6.0</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload