• 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: Get current amount of available RAM
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get current amount of available RAM


  • Subject: Re: Get current amount of available RAM
  • From: Bill Bumgarner <email@hidden>
  • Date: Wed, 27 Aug 2008 21:48:07 -0700

On Aug 27, 2008, at 9:31 PM, Alex Kac wrote:
I need to check for free RAM before performing a specific operation. I've Googled and checked in the docs and I suspect its my terminology that's just out of whack.

So what is the best way to find out how much available RAM is available in a Cocoa app?

That question isn't entirely relevant to coding on a multi-user, multi- processing, VM'ing system.


It is also a question that will change rapidly due to circumstances well beyond your application's control.

If you poke about the various mach_* APIs, you can grab some relevant statistics such as paging event rate or some stats on current memory usage, but it will largely just be hints.

In general, you should allocate what you need, use it as you see fit, and then release it when done. You generally use malloc() throughout, but vm_allocate() and friends can be used for more specialized memory management needs.

The real questions is why do you think you need to know how much RAM is available before doing something?

Are you looking for contiguous address space? You'll probably want to go 64 bit, then, as 32 bit will have much less than 4GB of contiguous address space available.

Are you looking to avoid paging? If so, you are kind of out of luck. There is nothing that can prevent another app from deciding to do something similar and forcing the system into paging death.

Something else?

b.bum

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Get current amount of available RAM
      • From: Alex Kac <email@hidden>
References: 
 >Get current amount of available RAM (From: Alex Kac <email@hidden>)

  • Prev by Date: Re: Get current amount of available RAM
  • Next by Date: Re: Core Data - use of simple accessors vs. KVC
  • Previous by thread: Re: Get current amount of available RAM
  • Next by thread: Re: Get current amount of available RAM
  • Index(es):
    • Date
    • Thread