All, My program building with SSL library run ok under debug mode,But dump under release build when produce PRNG.Using the Purify integration, it report that DUMP when calling RAND_screen(). When I use the Purify to check the memory leak of my SSL project,which in debug build,once I call RAND_screen() to generate PRNG(same like s_server.c).The purify report errors like below:
-------------------------------------------------------------------------- [W] PAR: UnmapViewOfFile(0x3120001) arg #1 (lpBaseAddress) not identical to value returned by MapViewOfFile (3120000) {1 occurrence} Call location UnmapViewOfFile [KERNEL32.dll] DllUnregisterServer [rsaenh.dll] DllUnregisterServer [rsaenh.dll] CPReleaseContext [rsaenh.dll] DllUnregisterServer [rsaenh.dll] RtlCharToInteger [ntdll.dll] RtlCharToInteger [ntdll.dll] LdrLoadDll [ntdll.dll] LoadLibraryExA [KERNEL32.dll] LoadLibraryA [KERNEL32.dll] CryptAcquireContextA [advapi32.dll] RAND_poll [LIBEAY32.dll] app_RAND_load_file [app_rand.c:133] #ifdef WINDOWS BIO_printf(bio_e,"Loading 'screen' into random state -"); BIO_flush(bio_e); => RAND_screen(); BIO_printf(bio_e," done\n"); #endif InitSSL [gextern.cpp:1130] if(WinSocket_init() <0) { return -2; } => if (!app_RAND_load_file(NULL, bio_err, 1) && !RAND_status()){ fprintf(stderr,"warning, not much extra random data, consider using the -rand option\n"); goto err; } main [main.cpp:120] -------------------------------------------------------------------------- I see the problem is RAND_screen().So my first question is whether SSL only using in debug build,and the purify tool is right? Can anyone help me about it ? Another,I have read lot of problem about memory leak in openssl-users forum. I think I had comply some experienced conduct ,such as noticing session cache mode,call some free function like ERR_remove_state(0),SSL_CTX_flush_sessions(ctx,time(NULL)) when end the SSL session. When debug in Solaris ,the memory states show that, after successed handshaking and data packet delivering continued dozens times, the heap occupancy grows 8k regular when create a new handshake. And the test application act as SSL client, session cache mode is OFF, a new handshake used a new SSL_CTX freed it when end. My application code have been checked with Boundschecker tool. I am bewildered with what happened. #top PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND 2275 root 5 48 0 2944K 2064K sleep 6:46 0.12% pa #memlook PID IMAGE RSS HEAP STACK 2275 3014656 2113536 262696 40960 Thanks. Stevens.Wang [EMAIL PROTECTED] 2002-03-14 ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]