mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
memory_status.c: support old Mac OS
* ext/-test-/memory_status/memory_status.c (read_status): use TASK_BASIC_INFO instead of MACH_TASK_BASIC_INFO on old Mac OS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c6eb59c439
commit
9e1a9858c8
1 changed files with 10 additions and 3 deletions
|
@ -17,12 +17,19 @@ read_status(VALUE self)
|
|||
#if defined __APPLE__
|
||||
VALUE rss;
|
||||
kern_return_t error;
|
||||
mach_msg_type_number_t out_count;
|
||||
# if defined MACH_TASK_BASIC_INFO
|
||||
const task_flavor_t flavor = MACH_TASK_BASIC_INFO;
|
||||
mach_msg_type_number_t out_count = MACH_TASK_BASIC_INFO_COUNT;
|
||||
mach_task_basic_info_data_t taskinfo;
|
||||
# else
|
||||
const task_flavor_t flavor = TASK_BASIC_INFO;
|
||||
mach_msg_type_number_t out_count = TASK_BASIC_INFO_COUNT;
|
||||
task_basic_info_data_t taskinfo;
|
||||
# endif
|
||||
|
||||
taskinfo.virtual_size = 0;
|
||||
out_count = MACH_TASK_BASIC_INFO_COUNT;
|
||||
error = task_info(mach_task_self(), MACH_TASK_BASIC_INFO,
|
||||
taskinfo.resident_size = 0;
|
||||
error = task_info(mach_task_self(), flavor,
|
||||
(task_info_t)&taskinfo, &out_count);
|
||||
if (error != KERN_SUCCESS) return Qnil;
|
||||
size = ULL2NUM(taskinfo.virtual_size);
|
||||
|
|
Loading…
Reference in a new issue