I've just tried it on the Windows box I'm currently on -- Sys::MemInfo works for me:

C:\strawberry>perl -MSys::MemInfo -e "print Sys::MemInfo::totalmem" 17118961664 C:\strawberry>

You're using a Mac, I take it? I have a gut feeling that the way the module is gathering its information (in darwin.xs) is wrong; Darwin/OS X has a sysctl for determining physical memory (CTL_HW and HW_MEMSIZE).

I see you've already filed a bug for this issue, but given that the module's last release is from 2006, who knows if or when it will be fixed. If you don't mind getting into XS programming, you could perhaps do it yourself, and maybe the fixed version could then be put on CPAN, too. (I don't know what the process is for "taking over" abandoned modules.)

That said, I agree with talexb: perhaps the proper question to ask is not "how do I reliably determine the actual amount of memory on this machine" as much as "how do I best accomplish this task". Do you even need to split your data into ~16 GB chunks for processing? Will using e.g. 4 GB chunks be significantly slower? For that matter, maybe there's a better way of doing what you want to do in the first place.


In reply to Re: How to Accurately Determine Amount of RAM by AppleFritter
in thread How to Accurately Determine Amount of RAM by hepcat72

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.