Sha256: 61662fe49ad808c868d0982f847e293ee7b1bd9a37b45e1a0e7be891588c1bae
Contents?: true
Size: 1.26 KB
Versions: 22
Compression:
Stored size: 1.26 KB
Contents
#import "InitMemoryInfoCollector.h" #include "../shared/common/RhoStd.h" #include "../shared/common/AutoPointer.h" #include "../shared/logging/RhoLogConf.h" #include <sstream> #import <mach/mach.h> namespace rho { namespace common { class IPhoneMemoryInfoCollector : public IMemoryInfoCollector { public: virtual String collect() { struct task_basic_info info; mach_msg_type_number_t size = sizeof(info); kern_return_t kerr = task_info(mach_task_self(),TASK_BASIC_INFO,(task_info_t)&info,&size); if ( KERN_SUCCESS == kerr ) { std::stringstream s; s << info.resident_size; return "Memory info: \nResident size: " + s.str() + "\n"; } else { return "Can't get memory info\n"; } } }; } } static rho::common::CAutoPtr<rho::common::IPhoneMemoryInfoCollector> s_memory_info_collector(new rho::common::IPhoneMemoryInfoCollector()); extern "C" { void InitMemoryInfoCollector() { LOGCONF().setMemoryInfoCollector(s_memory_info_collector); } }
Version data entries
22 entries across 22 versions & 2 rubygems