Skip to content
Snippets Groups Projects
Commit 2bb19aec authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

DRTVWR-418, MAINT-6996: Update Mac LLMemory::getCurrentRSS().

Evidently the Mac implementation of LLMemory::getCurrentRSS() goes back to
OS X 10.3, because there was a helpful comment of the form:

------
The API used here is not capable of dealing with 64-bit memory sizes, but is
available before 10.4.

Once we start requiring 10.4, we can use the updated API, which looks like
this:

[new current implementation]

Of course, this doesn't gain us anything unless we start building the viewer
as a 64-bit executable, since that's the only way for our memory allocation to
exceed 2^32.
------

Hey, guess what, we're building 64-bit viewers now!

Thank you, whoever thoughtfully noted that, both for calling out the issue and
sparing us the research. (The comment goes back to Subversion days, so hg
blame shows only the merge-to-release changeset.)
parent 52899ed6
No related branches found
No related tags found
No related merge requests found
...@@ -255,19 +255,6 @@ U64 LLMemory::getCurrentRSS() ...@@ -255,19 +255,6 @@ U64 LLMemory::getCurrentRSS()
#elif defined(LL_DARWIN) #elif defined(LL_DARWIN)
/*
The API used here is not capable of dealing with 64-bit memory sizes, but is available before 10.4.
Once we start requiring 10.4, we can use the updated API, which looks like this:
task_basic_info_64_data_t basicInfo;
mach_msg_type_number_t basicInfoCount = TASK_BASIC_INFO_64_COUNT;
if (task_info(mach_task_self(), TASK_BASIC_INFO_64, (task_info_t)&basicInfo, &basicInfoCount) == KERN_SUCCESS)
Of course, this doesn't gain us anything unless we start building the viewer as a 64-bit executable, since that's the only way
for our memory allocation to exceed 2^32.
*/
// if (sysctl(ctl, 2, &page_size, &size, NULL, 0) == -1) // if (sysctl(ctl, 2, &page_size, &size, NULL, 0) == -1)
// { // {
// LL_WARNS() << "Couldn't get page size" << LL_ENDL; // LL_WARNS() << "Couldn't get page size" << LL_ENDL;
...@@ -280,9 +267,9 @@ U64 LLMemory::getCurrentRSS() ...@@ -280,9 +267,9 @@ U64 LLMemory::getCurrentRSS()
U64 LLMemory::getCurrentRSS() U64 LLMemory::getCurrentRSS()
{ {
U64 residentSize = 0; U64 residentSize = 0;
task_basic_info_data_t basicInfo; task_basic_info_64_data_t basicInfo;
mach_msg_type_number_t basicInfoCount = TASK_BASIC_INFO_COUNT; mach_msg_type_number_t basicInfoCount = TASK_BASIC_INFO_64_COUNT;
if (task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&basicInfo, &basicInfoCount) == KERN_SUCCESS) if (task_info(mach_task_self(), TASK_BASIC_INFO_64, (task_info_t)&basicInfo, &basicInfoCount) == KERN_SUCCESS)
{ {
residentSize = basicInfo.resident_size; residentSize = basicInfo.resident_size;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment