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.
|