[ 
https://issues.apache.org/jira/browse/MESOS-318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benjamin Mahler reassigned MESOS-318:
-------------------------------------

    Assignee: Vinod Kone  (was: Chris A. Mattmann)
    
> 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
>    Affects Versions: 0.9.0, 0.10.0, 0.11.0, 0.12.0
>            Reporter: Benjamin Mahler
>            Assignee: Vinod Kone
>             Fix For: 0.13.0
>
>
> 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

Reply via email to