- 论坛徽章:
- 0
|
在Shared Library里创建对象后将来释放时的疑虑
to Alligator27:
我想你也看了我另一篇帖子《关于Shared Library在Solaris和HP-UX的不同结果》,用purify联编其中的源代码后,检测日志如下,反映出有内存泄露的问题!!!
**** Purify instrumented ./test (pid 12204) ****
Current file descriptors in use: 5
FIU: file descriptor 0: <stdin>;
FIU: file descriptor 1: <stdout>;
FIU: file descriptor 2: <stderr>;
FIU: file descriptor 26: <reserved for Purify internal use>;
FIU: file descriptor 27: <reserved for Purify internal use>;
**** Purify instrumented ./test (pid 12204) ****
Purify: Searching for all memory leaks...
Memory leaked: 16 bytes (0.0784%); potentially leaked: 1232 bytes (6.03%)
MLK: 16 bytes leaked at 0x40052ac8
* This memory was allocated from:
malloc [rtlib.o]
__shlInit [libCsup_v2.2]
*unknown func* [pc=0xc87ec6a4]
__shlinit [libCsup_v2.2]
form_load_graph#HLO_CL_#c10_0x0 [dld.sl]
findlibsym#HLO_CL_#i2_0x3#I3_0x1#i4_0x0 [dld.sl]
PLK: 1168 bytes potentially leaked in 8 blocks
* This memory was allocated from:
malloc [rtlib.o]
__nW__fUl [libCsup_v2.2]
operator new(unsigned long) [rtlib.o]
std::allocator<char>;::allocate(unsigned long,const void *) [memory]
std::basic_string<char,std::char_traits<char>;,std::allocator<char>;>;::_C_getRep(unsigned long,unsigned long) [string.c
c]
std::basic_string<char,std::char_traits<char>;,std::allocator<char>;>;::replace(unsigned long,unsigned long,const char *
,unsigned long,unsigned long,unsigned long) [string.cc]
* Block of 146 bytes (8 times); last block at 0x40031f00
PLK: 32 bytes potentially leaked at 0x4002e890
* This memory was allocated from:
malloc [rtlib.o]
__nWa__FuL [libCsup_v2.2]
operator new[](unsigned long) [rtlib.o]
static std::locale::_C_init() [libstd_v2.2]
std::ios_base::Init::Init()%2 [libstd_v2.2]
Static initializer (sinit) for "std::main_cpp_()" [main.o]
PLK: 32 bytes potentially leaked at 0x4002e908
* This memory was allocated from:
malloc [rtlib.o]
__nWa__FuL [libCsup_v2.2]
operator new[](unsigned long) [rtlib.o]
static std::locale::_C_init() [libstd_v2.2]
std::ios_base::Init::Init()%2 [libstd_v2.2]
Static initializer (sinit) for "std::main_cpp_()" [main.o]
Purify Heap Analysis (combining suppressed and unsuppressed blocks)
Blocks Bytes
Leaked 1 16
Potentially Leaked 11 1488
In-Use 62 18911
----------------------------------------
Total Allocated 74 20415
**** Purify instrumented ./test (pid 12204) ****
Thread Summary : 1 threads in existence
* Thread 0 [main thread]
Stack Limit : (0x7f7f0c80 0x7fff0c80), size = 0x800000 |
|