You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by "Vinod Kone (JIRA)" <ji...@apache.org> on 2013/03/01 07:09:12 UTC
[jira] [Resolved] (MESOS-318) os::memory does not consider
sysinfo.mem_unit
[ https://issues.apache.org/jira/browse/MESOS-318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vinod Kone resolved MESOS-318.
------------------------------
Resolution: Fixed
> os::memory does not consider sysinfo.mem_unit
> ---------------------------------------------
>
> Key: MESOS-318
> URL: https://issues.apache.org/jira/browse/MESOS-318
> Project: Mesos
> Issue Type: Bug
> Reporter: Benjamin Mahler
> Assignee: Vinod Kone
>
> This may manifest in buggy detection of system memory, especially in 32 bit systems running with more than 4GB of RAM.
> Current code:
> // Returns the total size of main memory in bytes.
> inline Try<uint64_t> memory()
> {
> #ifdef __linux__
> struct sysinfo info;
> if (sysinfo(&info) != 0) {
> return Try<uint64_t>::error(strerror(errno));
> }
> return info.totalram;
> #else
> return Try<uint64_t>::error("Cannot determine the size of main memory");
> #endif
> }
> Fixed:
> // Returns the total size of main memory in bytes.
> inline Try<uint64_t> memory()
> {
> #ifdef __linux__
> struct sysinfo info;
> if (sysinfo(&info) != 0) {
> return Try<uint64_t>::error(strerror(errno));
> }
> return info.totalram * info.mem_unit;
> #else
> return Try<uint64_t>::error("Cannot determine the size of main memory");
> #endif
> }
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira