Changeset 4314


Ignore:
Timestamp:
Feb 6, 2010, 2:37:52 AM (7 years ago)
Author:
sam
Message:

On OS X, resident_size is actually in bytes, not pages. Fixing
memory check routine.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/src/libzzuf/lib-mem.c

    r4286 r4314  
    132132/* setrlimit(RLIMIT_AS) is ignored on OS X, we need to check memory usage
    133133 * from inside the process. Oh, and getrusage() doesn't work either. */
    134 #if defined HAVE_MACH_TASK_H
    135 vm_size_t mach_page_size;
    136 #endif
    137 
    138134static int memory_exceeded(void)
    139135{
     
    144140    if (task_info(mach_task_self(), TASK_BASIC_INFO,
    145141                  (task_info_t)&tbi, &mmtn) == KERN_SUCCESS
    146          && (int64_t)tbi.resident_size * mach_page_size / 1048576
    147                   > (int64_t)_zz_memory)
     142         && (int64_t)tbi.resident_size / 1048576 > (int64_t)_zz_memory)
    148143        return 1;
    149144#endif
     
    157152    LOADSYM(malloc);
    158153    LOADSYM(realloc);
    159 
    160 #if defined HAVE_MACH_TASK_H
    161     host_page_size(mach_host_self(), &mach_page_size);
    162 #endif
    163154}
    164155
Note: See TracChangeset for help on using the changeset viewer.