• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSImage and F_NOCACHE
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage and F_NOCACHE


  • Subject: Re: NSImage and F_NOCACHE
  • From: Brian Bergstrand <email@hidden>
  • Date: Wed, 4 Oct 2006 12:39:44 -0500

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Oct 4, 2006, at 10:48 AM, Alexander Cohen wrote:

Hi,

Im using F_NOCACHE with fcntl just before loading the file up as an NSImage so the data does not get cached and memory stays down. Im doing this because im converting thousands of images ( eps, tif, psd, pdf, anything... ). Thing is, memory never comes down. I though it might be a memory leak or something so i brought the code down to this:


int err = 0; int fd = open( [self cString], O_RDWR ); err = fcntl(fd, F_NOCACHE, 1); NSImage* img = [[NSImage alloc] initWithContentsOfFile:self]; [img release]; img = nil;


If i comment out the NSImage line, memory stays down of course, as soon as i add it back in, memory goes way up. BTW, fcntl is always returning 0 so there are no errors. Any ideas what might be going on?



Your NOCACHE directive only applies to the fd you opened. NSImage is going to open it's own fd. In this case, you should read the file yourself into an NSData instance, and then use that to init an NSImage instance.


Brian Bergstrand
<http://www.bergstrand.org/brian/>   PGP Key ID: 0xB6C7B6A2

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFI/HgedHYW7bHtqIRAgVeAJ96QJCVnBx7CInMXDQxhWX/YFLv3wCg5pWZ
JBM1SumBVIql05xm7K1NVFg=
=LGLC
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSImage and F_NOCACHE (From: Alexander Cohen <email@hidden>)

  • Prev by Date: Passing NSString to system()
  • Next by Date: Re: Passing NSString to system()
  • Previous by thread: Re: NSImage and F_NOCACHE
  • Next by thread: Re: NSImage and F_NOCACHE
  • Index(es):
    • Date
    • Thread