site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com I have 24/7 that has a slow memory leak... I would like regularly log the real Total memory size(VSIZE ) that my app is using. What's the best way to retrieve this information from the System? You can also use top in logging mode, with a syntax something like: top -l <maxiterations> -S -s <interval> -U <username> -c e Wade _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Well, naturally there's tools at the end-user level like ObjectAlloc, MallocDebug and Shark, but if your app is frequently allocating & deallocating memory, they're probably not going to be practical to run over the time spans you'd like. So, you can roll your own recorder in several ways. It depends, naturally, on how you want to do so. "vmmap" will give you all sorts of numbers, and could be logged periodically using a script, and parsed and played with and all that. (there's also its cousin vm_stat which provides general system-wide stats, if that's of interest) There's no way I'm aware of to have it just look at one process, though you could pass the output through grep easily enough to filter it. If you want the information programmatically, you can include <mach/ mach.h> and then poke with such functions as task_info(), to get the task_basic_info for your chosen task (you can get the necessary task_t using task_for_pid(), defined in /usr/include/mach/ mach_traps.h). See http://web.mit.edu/darwin/src/modules/xnu/osfmk/ man/ for documentation. This email sent to site_archiver@lists.apple.com