• 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: RAM Location and Size in 64bits Machines
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RAM Location and Size in 64bits Machines


  • Subject: Re: RAM Location and Size in 64bits Machines
  • From: Alastair Houghton <email@hidden>
  • Date: Mon, 23 May 2005 11:25:50 +0100

On 14 May 2005, at 10:12, Fabio wrote:

Hi
I know it's very easy to get the RAM location and size on 32 bits machines:
http://developer.apple.com/qa/qa2001/qa1065.html


Now how about 64 bits machines? And dual processors 64 bits machines?
I was able to built an app that works on most of the computers but it seems that is doesn't always work and I must confess that I have no idea how to fix that.
On dual-processors 64 bits machines, it seems that if you have 2x512MB the system will think that you have a single 1GB.
Please help, I don't want to parse System_profiler's result :(

Hi Fabio,

Have you tried sysctl(3)?  e.g.

  int mib[2], ret;
  u_int64_t memsize;

  mib[0] = CTL_HW;
  mib[1] = HW_PHYSMEM;

  ret = sysctl (mib, 2, &memsize, sizeof (memsize), NULL, 0);

This is much cleaner than relying on knowledge of configuration registers exposed by OpenFirmware/IO Registry.

See man 3 sysctl and <sys/sysctl.h> for more information.

Kind regards,

Alastair.

--
http://www.alastairs-place.net


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

 _______________________________________________
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

References: 
 >RAM Location and Size in 64bits Machines (From: Fabio <email@hidden>)

  • Prev by Date: [ANN] Shellac 1.0 -- UNIX tools as Automator actions!
  • Next by Date: Re: problem unmounting and ejecting a disk image
  • Previous by thread: RAM Location and Size in 64bits Machines
  • Next by thread: Re: RAM Location and Size in 64bits Machines
  • Index(es):
    • Date
    • Thread