• 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
Why is this code leaking memory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why is this code leaking memory?


  • Subject: Why is this code leaking memory?
  • From: Jan Van Boghout <email@hidden>
  • Date: Thu, 19 Dec 2002 20:31:26 +0100

Hello everybody,

I have two lines that load an imageRep of an image on the HD, and
they're leaking memory like hell. Any ideas why this is happening? It
shouldn't, that's the problem.

Code:

imageRep = [NSBitmapImageRep imageRepWithData:[NSData
dataWithContentsOfFile:@"/Library/Desktop Pictures/Aqua Blue.jpg"]];

[imageRep release];

Say I want to load the Aqua Blue desktop pic. *Every* time this gets
called my test app's virtual memory usage increases with 3 MB or more,
I don't even need to load different pics. Any ideas to prevent this
from happening? Shouldn't the release actually release the memory? I
also tried creating the data separately and releasing it separately,
but that doesn't solve the leak either.

All ideas much appreciated,

Jan Van Boghout
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Why is this code leaking memory?
      • From: Dan Wood <email@hidden>
    • Re: Why is this code leaking memory?
      • From: email@hidden
  • Prev by Date: Re: Problem in coding integers/floats
  • Next by Date: Re: Newbie NSWindow question
  • Previous by thread: Preference file naming conventions (Was: Re: NSUserDefauts - Am I Missing the Obvious?)
  • Next by thread: Re: Why is this code leaking memory?
  • Index(es):
    • Date
    • Thread