|
楼主 |
发表于 2009-6-16 10:34:41
|
显示全部楼层
一次性内存泄露上面说的,比如ace的托管singleton,在初了main函数ace也管释放,非托管singleton我在调用ace的fini之前也手动close了。总之走正常退出流程也杜绝这样的一次性泄露。
如果不正常退出,也就是运行了很久ctrl+c退出就会有很多reachable的log。
==1279== 962,795 bytes in 235 blocks are still reachable in loss record 101 of 102
==1279== at 0x40051B3: operator new[](unsigned, std::nothrow_t const&) (vg_replace_malloc.c:207)
==1279== by 0x41A3404: ACE_Log_Msg::ACE_Log_Msg() (Log_Msg.cpp:708)
==1279== by 0x41A3669: ACE_Log_Msg::instance() (Log_Msg.cpp:365)
==1279== by 0x41A3701: ACE_Log_Msg::inherit_hook(ACE_OS_Thread_Descriptor*, ACE_OS_Log_Msg_Attributes&) (Log_Msg.cpp:2665)
==1279== by 0x417526F: ACE_Base_Thread_Adapter::inherit_log_msg() (Base_Thread_Adapter.cpp:65)
==1279== by 0x420FE74: ACE_Thread_Adapter::invoke() (Thread_Adapter.cpp:53)
==1279== by 0x4175320: ace_thread_adapter (Base_Thread_Adapter.cpp:116)
==1279== by 0x43ED2DA: start_thread (in /lib/libpthread-2.5.so)
==1279== by 0x437814D: clone (in /lib/libc-2.5.so)
==1279==
==1279==
==1279== 981,360 bytes in 235 blocks are still reachable in loss record 102 of 102
==1279== at 0x4005311: operator new(unsigned, std::nothrow_t const&) (vg_replace_malloc.c:179)
==1279== by 0x41A3659: ACE_Log_Msg::instance() (Log_Msg.cpp:365)
==1279== by 0x41A3701: ACE_Log_Msg::inherit_hook(ACE_OS_Thread_Descriptor*, ACE_OS_Log_Msg_Attributes&) (Log_Msg.cpp:2665)
==1279== by 0x417526F: ACE_Base_Thread_Adapter::inherit_log_msg() (Base_Thread_Adapter.cpp:65)
==1279== by 0x420FE74: ACE_Thread_Adapter::invoke() (Thread_Adapter.cpp:53)
==1279== by 0x4175320: ace_thread_adapter (Base_Thread_Adapter.cpp:116)
==1279== by 0x43ED2DA: start_thread (in /lib/libpthread-2.5.so)
==1279== by 0x437814D: clone (in /lib/libc-2.5.so)
[ 本帖最后由 sokiiya 于 2009-6-16 15:16 编辑 ] |
|