[Quickfix-developers] Fixed massive memory leak in .NET CPPMessageStore
Brought to you by:
orenmnero
From: Vladimir A. <Vla...@FF...> - 2004-10-26 11:19:32
|
Hello, I=20have=20fixed=20a=20massive=20memory=20leak=20in=20.NET=20CPPMessageSto= re=20class=20in QuickFIX=201.9.2.=20Every=20time=20a=20FIX=20message=20was=20stored,=20a=20= copy=20would=20be leaked.=20My=20tests=20show=20that=20hundreds=20of=20megabytes(!)=20of=20m= emory=20may=20be leaked=20in=20a=20few=20hours=20on=20a=20busy=20server,=20making=20it=20ru= n=20out=20of=20memory. The=20bug=20seems=20to=20be=20a=20rather=20silly=20oversight=20and=20it=20= could=20be automatically=20detected=20by=20VS.NET=20compiler=20if=20only=20Warning=20= Level=204=20was selected=20in=20the=20project=20settings=20(this,=20unfortunately,=20repor= ts=20dozens=20of other=20less=20severe=20warnings,=20so=20code=20cleanup=20would=20be=20ine= vitable=20to=20get=20a clean=20build). Method=20CPPMessageStore::get(=20int=20sequence,=20String*=20message=20)=20= was completely=20broken,=20but=20it=20didn't=20show=20up=20because=20it=20is=20= never=20called. Here=20is=20the=20diff: ---=20CPPMessageStore.h=092004-04-29=2015:08:18.000000000=20+0200 +++=20CPPMessageStore.h.new=092004-10-26=2011:58:51.597017500=20+0200 @@=20-48,8=20+48,9=20@@ =20 =20=20=20=20=20try =20=20=20=20=20{=20char*=20umessage=20=3D=20createUnmanagedString(=20messa= ge=20); -=20=20=20=20=20=20return=20m_pUnmanaged->set(=20sequence,=20umessage=20);= =20 +=20=20=20=20=20=20bool=20rc=20=3D=20m_pUnmanaged->set(=20sequence,=20umes= sage=20);=20 =20=20=20=20=20=20=20destroyUnmanagedString(=20umessage=20); +=20=20=20=20=20=20return=20rc; =20=20=20=20=20} =20=20=20=20=20catch=20(=20FIX::IOException&=20) =20=20=20=20=20{=20throw=20new=20IOException();=20} @@=20-63,8=20+64,9=20@@ =20=20=20=20=20try =20=20=20=20=20{ =20=20=20=20=20=20=20std::string=20string; -=20=20=20=20=20=20return=20m_pUnmanaged->get(=20sequence,=20string=20); +=20=20=20=20=20=20bool=20rc=20=3D=20m_pUnmanaged->get(=20sequence,=20stri= ng=20); =20=20=20=20=20=20=20message=20=3D=20string.c_str(); +=20=20=20=20=20=20return=20rc; =20=20=20=20=20} =20=20=20=20=20catch=20(=20FIX::IOException&=20) =20=20=20=20=20{=20throw=20new=20IOException();=20} Please=20put=20this=20patch=20to=20the=20official=20source=20tree=20before= =20the=20next release. Cheers, =20=20Vlad ------------------------------------------------------------- Ing.=20Vladimir=20Arnost,=20Developer,=20FFastFill=20Europe=20Ltd. Vaclavske=20namesti=2055,=20Prague,=20Czech=20Republic ________________________________________________________________________ This=20email=20and=20any=20files=20transmitted=20with=20it=20are=20confide= ntial=20and intended=20solely=20for=20the=20use=20of=20the=20individual=20or=20entity=20= to=20whom=20they are=20addressed.=20If=20you=20have=20received=20this=20email=20in=20error=20= please=20notify sec...@ff... This=20email=20has=20been=20scanned=20for=20all=20viruses=20by=20the=20FFa= stFill=20Email Security=20System. ________________________________________________________________________ |