Re: [Quickfix-developers] Fixed massive memory leak in .NET CPPMessageStore
Brought to you by:
orenmnero
From: Oren M. <or...@qu...> - 2004-10-26 14:16:51
|
Thanks Vlad, We are actually removing that method. It is redundant and is not even =20= used as you pointed out since the session always uses the get call that =20= returns a range. We'll add this patch. Thanks for giving the .NET API =20= a workout. --oren On Oct 26, 2004, at 6:19 AM, Vladimir Arnost wrote: > Hello, > > I have fixed a massive memory leak in .NET CPPMessageStore class in =20= > QuickFIX 1.9.2. Every time a FIX message was stored, a copy would be =20= > leaked. My tests show that hundreds of megabytes(!) of memory may be =20= > leaked in a few hours on a busy server, making it run out of memory. > > The bug seems to be a rather silly oversight and it could be =20 > automatically detected by VS.NET compiler if only Warning Level 4 was =20= > selected in the project settings (this, unfortunately, reports dozens =20= > of other less severe warnings, so code cleanup would be inevitable to =20= > get a clean build). > > Method CPPMessageStore::get( int sequence, String* message ) was =20 > completely broken, but it didn't show up because it is never called. > > > > Here is the diff: > > --- CPPMessageStore.h=A0=A0 2004-04-29 15:08:18.000000000 +0200 > +++ CPPMessageStore.h.new=A0=A0=A0=A0=A0=A0 2004-10-26 = 11:58:51.597017500 +0200 > @@ -48,8 +48,9 @@ > =A0 > =A0=A0=A0=A0 try > =A0=A0=A0=A0 { char* umessage =3D createUnmanagedString( message ); > -=A0=A0=A0=A0=A0 return m_pUnmanaged->set( sequence, umessage ); > +=A0=A0=A0=A0=A0 bool rc =3D m_pUnmanaged->set( sequence, umessage ); > =A0=A0=A0=A0=A0=A0 destroyUnmanagedString( umessage ); > +=A0=A0=A0=A0=A0 return rc; > =A0=A0=A0=A0 } > =A0=A0=A0=A0 catch ( FIX::IOException& ) > =A0=A0=A0=A0 { throw new IOException(); } > @@ -63,8 +64,9 @@ > =A0=A0=A0=A0 try > =A0=A0=A0=A0 { > =A0=A0=A0=A0=A0=A0 std::string string; > -=A0=A0=A0=A0=A0 return m_pUnmanaged->get( sequence, string ); > +=A0=A0=A0=A0=A0 bool rc =3D m_pUnmanaged->get( sequence, string ); > =A0=A0=A0=A0=A0=A0 message =3D string.c_str(); > +=A0=A0=A0=A0=A0 return rc; > =A0=A0=A0=A0 } > =A0=A0=A0=A0 catch ( FIX::IOException& ) > =A0=A0=A0=A0 { throw new IOException(); } > > > > Please put this patch to the official source tree before the next =20 > release. > > Cheers, > =A0 Vlad > > ------------------------------------------------------------- > Ing. Vladimir Arnost, Developer, FFastFill Europe Ltd. > Vaclavske namesti 55, Prague, Czech Republic > > > =20 > = _______________________________________________________________________=20= > _ > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > sec...@ff... > > This email has been scanned for all viruses by the FFastFill Email > Security System. > =20 > = _______________________________________________________________________=20= > _ > =20= |