From: Duncan M. <du...@on...> - 2009-07-06 13:28:36
|
Sorry to repost, but this has become a real blocker for me - I thought I'd try one last time before giving up and re-coding in ObjC. I can't persuade RubyCocoa to CFRelease a CGImageSourceRef without a bus error - as a result my PDF writing code is leaking like a sieve. require 'test/unit' require 'osx/cocoa' include OSX class QuartzPDFWriterTest < Test::Unit::TestCase def setup @testdir = TestDir.new(self) end def test_dispose_CGImageSource 1.upto(10000) do |i| p i imageSource = CGImageSourceCreateWithURL(NSURL.fileURLWithPath('testdata/pot pourri/ blood.jpg'), nil) image = CGImageSourceCreateImageAtIndex(imageSource, 0, nil) CFRelease image CFRelease imageSource end end end CFRelease imageSource results in a segfault or bus error. For low iteration counts this happens after the test has finished, increasing the count makes it happen during the loop, suggesting a problem during garbage collection I think. If I don't CFRelease imageSource then I run out of memory to load any more images after about 4000 iterations with my test file. Does anyone have any ideas please? Duncan McGregor |