ACE VERSION: 5.1.18
HOST MACHINE and OPERATING SYSTEM: Intel pIII Windows NT
TARGET MACHINE and OPERATING SYSTEM, if different from HOST: Same
COMPILER NAME AND VERSION (AND PATCHLEVEL): VC++ 6.0 SP4
AREA/CLASS/EXAMPLE AFFECTED:
ace::init and ace::fini
DOES THE PROBLEM AFFECT:
COMPILATION? no
LINKING? no
EXECUTION? yes
OTHER (please specify)? no
SYNOPSIS:
Using ace::init and ace::fini leaks memory
approx. 4400bytes/cyclus
DESCRIPTION:
When it's necessary to use ace::init and ace::fini more than one's
there's a memory leak. 4400 bytes/cyclus is not much,
but enough for long running applications.
While this isn't a problem form most applications, it could be
a problem when it's only possible to interface to a DLL
(which uses ACE) with a simple call interface.
REPEAT BY:
See program snippet
#define ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER
#define ACE_NO_INLINE
#include "ace/SOCK_Connector.h"
int main (int argc, char *argv[])
{
// leaks about 4340 bytes (with each iteration)
cout << "Check memory" << endl;
ACE_OS::sleep(20);
cout << "Starting 10000 iterations" << endl;
unsigned long counter = 0;
while(counter < 10000)
{
ACE::init();
ACE::fini();
++counter;
};
cout << "Check memory" << endl;
ACE_OS::sleep(20);
return 0;
}
SAMPLE FIX/WORKAROUND:
If possible use ace::init and ace::fini when the apllication
starts and stops (with extra functions in a DLL), but
as said this is not always possible.
Alain
Thanks for using the PRF.
>> ACE VERSION: 5.1.18
>>
>> HOST MACHINE and OPERATING SYSTEM: Intel pIII Windows NT
>> TARGET MACHINE and OPERATING SYSTEM, if different from HOST: Same
>> COMPILER NAME AND VERSION (AND PATCHLEVEL): VC++ 6.0 SP4
>>
>> AREA/CLASS/EXAMPLE AFFECTED:
>> ace::init and ace::fini
>>
>> DOES THE PROBLEM AFFECT:
>> COMPILATION? no
>> LINKING? no
>> EXECUTION? yes
>> OTHER (please specify)? no
>>
>>
>> SYNOPSIS:
>>
>> Using ace::init and ace::fini leaks memory
>> approx. 4400bytes/cyclus
>>
>>
>> DESCRIPTION:
>> When it's necessary to use ace::init and ace::fini more than one's
>> there's a memory leak. 4400 bytes/cyclus is not much,
>> but enough for long running applications.
>> While this isn't a problem form most applications, it could be
>> a problem when it's only possible to interface to a DLL
>> (which uses ACE) with a simple call interface.
Since it looks like you're using a memory leak detector (e.g., Purify
or BoundsChecker), please let us know where the problem is occurring,
i.e., where does the tool pinpoint the problem to be?
Thanks,
Doug
>>
>> REPEAT BY:
>>
>> See program snippet
>>
>> #define ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER
>> #define ACE_NO_INLINE
>> #include "ace/SOCK_Connector.h"
>>
>> int main (int argc, char *argv[])
>> {
>> // leaks about 4340 bytes (with each iteration)
>>
>> cout << "Check memory" << endl;
>> ACE_OS::sleep(20);
>> cout << "Starting 10000 iterations" << endl;
>> unsigned long counter = 0;
>> while(counter < 10000)
>> {
>> ACE::init();
>>
>> ACE::fini();
>> ++counter;
>> };
>> cout << "Check memory" << endl;
>> ACE_OS::sleep(20);
>> return 0;
>> }
>>
>> SAMPLE FIX/WORKAROUND:
>> If possible use ace::init and ace::fini when the apllication
>> starts and stops (with extra functions in a DLL), but
>> as said this is not always possible.
>>
>>
>>
>> Alain
>>
--
Dr. Douglas C. Schmidt, Associate Professor TEL: (949) 824-1901
Dept of Electrical & Computer Engineering FAX: (949) 824-2321
616E Engineering Tower WEB: www.ece.uci.edu/~schmidt/
University of California, Irvine, 92697-2625 NET: sch...@uci.edu