You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mesos.apache.org by "Benjamin Mahler (JIRA)" <ji...@apache.org> on 2012/12/06 19:57:09 UTC
[jira] [Created] (MESOS-318) os::memory does not consider
sysinfo.mem_unit
Benjamin Mahler created MESOS-318:
-------------------------------------
Summary: 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
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