• 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: Memory usage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory usage


  • Subject: Re: Memory usage
  • From: Matt Neuburg <email@hidden>
  • Date: Thu, 24 Mar 2005 17:24:37 -0800

On Fri, 25 Mar 2005 00:39:37 +0100, Michael Becker <email@hidden>
said:
>Hi!
>
>I am not sure if this is the appropriate list to post this, but I am
>sure people here can answer my question. I have an application that
>reads out and displays the iPhoto library. After selecting one of the
>albums, the images of this album are read from disk and displayed. So
>far, everything works fine, but I just checked my memory usage with the
>command-line tool "top".
>
>I must admit that I am in no ways a memory expert, so there may be
>wrong assumptions here. What worries me the most is, that unlike
>iPhoto, my app's stats grow worse over time. That means, if I change
>between the albums, each of the numbers in top grows. Although I am
>properly releasing my objects, it seems as memory usage increases.
>
>In my list, every running app uses at most about 400 REGS (memory
>regions). But my app (after some album switching) easily reaches more
>than 1500 of those.
>
>Now here is the question: Why does my app increase in memory usage even
>though I properly facilitate Cocoa's memory management? Say, I have 100
>images in the current album view. When I switch the album, those 100
>images are released, then the new album's images are read from disk. If
>the new album only has 10 images, shouldn't that drop my mem-usage?
>
>I'm sorry if I am asking stupid questions, but as I mentioned before, I
>am new to this stuff and a little scared of the moment when a user uses
>my app for more than 30 minutes :-)

First of all, don't do memory management with any other tool than e.g.
ObjectAlloc. Mac OS X virtual memory will mislead you, because it retains
memory you are not actually using, so think only in terms of actual objects
/ leaks. That said, virtual memory itself can take a little management. The
problem might be that virtual memory doesn't let go of disk areas that you
read. This is very noticeable with big disk areas (i.e. images). I had this
problem with an image-processing app until Michael Rothwell put me onto
fcntl and F_NOCACHE. This solved things instantly. Check the archives. m.

PS Also memory management with images is tricky in general because of
caching. I do a lot of recaching (perhaps unnecessarily).

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>



 _______________________________________________
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

  • Follow-Ups:
    • Re: Memory usage
      • From: Michael Becker <email@hidden>
  • Prev by Date: Re: A Challenge WAS Accessor method idioms...
  • Next by Date: using apple material
  • Previous by thread: Re: Memory usage
  • Next by thread: Re: Memory usage
  • Index(es):
    • Date
    • Thread