[omniORB] OmniORB3.01 - Reducing memory leaks - patch 4
Jeroen.Dobbelaere@MMR.be
Jeroen.Dobbelaere@MMR.be
Fri, 15 Sep 2000 16:16:23 +0100
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C01F27.E9225550
Content-Type: text/plain;
charset="ISO-8859-1"
Hi,
This patch add's protection to memory leaks in proxyFactory.cc
Greetings,
--
Jeroen Dobbelaere
Software Design Engineer
Micro-Matic Research <http://www.mmr.be>
<<patch4.patch>>
------_=_NextPart_000_01C01F27.E9225550
Content-Type: application/octet-stream;
name="patch4.patch"
Content-Disposition: attachment;
filename="patch4.patch"
*** omni/src/lib/OmniORB2/orbcore/proxyFactory.cc Fri Aug 18 15:09:12 2000
--- omni_test/src/lib/OmniORB2/orbcore/proxyFactory.cc Fri Sep 15 16:04:25 2000
***************
*** 56,66 ****
static proxyObjectFactory** ofl = 0;
static int ofl_size = 0;
static int ofl_len = 0;
! proxyObjectFactory::~proxyObjectFactory() {}
proxyObjectFactory::proxyObjectFactory(const char* repoId)
{
// These factories are constructed statically in the stubs, thus
--- 56,70 ----
static proxyObjectFactory** ofl = 0;
static int ofl_size = 0;
static int ofl_len = 0;
! // cleanup pd_repoId !!
! proxyObjectFactory::~proxyObjectFactory()
! {
! delete [] (char*)pd_repoId;
! }
proxyObjectFactory::proxyObjectFactory(const char* repoId)
{
// These factories are constructed statically in the stubs, thus
***************
*** 118,127 ****
--- 122,132 ----
void
proxyObjectFactory::shutdown()
{
delete[] ofl;
+ ofl = NULL;
ofl_size = 0;
ofl_len = 0;
}
***************
*** 150,154 ****
--- 155,168 ----
else return ofl[middle];
}
return 0;
}
+
+ // make sure that everything gets cleaned up, even if the ORB itself has not been used
+ class CleanUpTheProxyFactory
+ {
+ public:
+ ~CleanUpTheProxyFactory() { proxyObjectFactory::shutdown(); }
+ };
+
+ static CleanUpTheProxyFactory local_cleanUpTheProxyFactory;
------_=_NextPart_000_01C01F27.E9225550--