On Mon, Sep 8, 2008 at 9:04 PM, Aaron VonderHaar <[EMAIL PROTECTED]> wrote:
> Hi,  I am trying to write some automated scenario tests that verify
> that my application meets it's the memory usage constraint
> requirements.
>
> What API is available to find out how much memory an
> application/process/thread has allocated?
>
> I have looked at the documentation for NSZone, NSProcessInfo,
> NSThread, NSAutoreleasePool, NSTask, NSApplication, the "Interacting
> with the Operating System" guide and the "Memory Management
> Programming Guide for Cocoa" guide but I have not found any
> information about how to find out the number of pages, bytes or
> objects that are in use.

That's probably because it's an extremely difficult concept on a UNIX system.

If you load a framework, does that framework's code count against your
process's memory usage? What if the framework is also loaded by a
bunch of other applications, and you're all sharing it?

If you malloc a large piece of memory but don't touch it yet (so that
the OS has yet to actually back that allocation), does that count?

If you memory map a file, does that count? What if some other
processes have memory mapped the same file?

If you allocate some memory, and use it, and then it gets swapped out
to disk, does that still count?

If you allocate memory using a lower-level call such as vm_allocate,
does that count?

Figure out the answers to these questions and you should be some way
toward figuring out the answer to your question. Note that none of the
question above are rhetorical; there are no "right" answers to them.
Both "yes" and "no" are "right", it all depends on how you want your
accounting to work.

Mike
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to