project_files/HedgewarsMobile/Classes/CommodityFunctions.m
changeset 5486 e75f7c3c6275
parent 5483 fc755bb8096d
child 5994 3c578f531cc1
equal deleted inserted replaced
5485:e943a005d0e8 5486:e75f7c3c6275
    39     return (res == NETGAME_DEFAULT_PORT) ? randomPort() : res;
    39     return (res == NETGAME_DEFAULT_PORT) ? randomPort() : res;
    40 }
    40 }
    41 
    41 
    42 // by http://landonf.bikemonkey.org/code/iphone/Determining_Available_Memory.20081203.html
    42 // by http://landonf.bikemonkey.org/code/iphone/Determining_Available_Memory.20081203.html
    43 void print_free_memory () {
    43 void print_free_memory () {
       
    44 #ifdef DEBUG
    44     mach_port_t host_port;
    45     mach_port_t host_port;
    45     mach_msg_type_number_t host_size;
    46     mach_msg_type_number_t host_size;
    46     vm_size_t pagesize;
    47     vm_size_t pagesize;
    47 
    48 
    48     host_port = mach_host_self();
    49     host_port = mach_host_self();
    57     /* Stats in bytes */
    58     /* Stats in bytes */
    58     natural_t mem_used = (vm_stat.active_count + vm_stat.inactive_count + vm_stat.wire_count) * pagesize;
    59     natural_t mem_used = (vm_stat.active_count + vm_stat.inactive_count + vm_stat.wire_count) * pagesize;
    59     natural_t mem_free = vm_stat.free_count * pagesize;
    60     natural_t mem_free = vm_stat.free_count * pagesize;
    60     natural_t mem_total = mem_used + mem_free;
    61     natural_t mem_total = mem_used + mem_free;
    61     DLog(@"used: %u free: %u total: %u", mem_used, mem_free, mem_total);
    62     DLog(@"used: %u free: %u total: %u", mem_used, mem_free, mem_total);
       
    63 #endif
    62 }
    64 }
    63 
    65 
    64 BOOL inline isApplePhone () {
    66 BOOL inline isApplePhone () {
    65     return (IS_IPAD() == NO);
    67     return (IS_IPAD() == NO);
    66 }
    68 }