[omniORB] Memory Leak in Unmarshal (OmniOrb 4.1/VC7)

Dave Vaughan dave.vaughan@thales-is.com
Tue Feb 11 18:08:02 2003


This is almost certainly something stupid that I am doing rather than a
bug in OMNIORB, but I would appreciate some help please.

1. I am running an OMNIORB 4 client on Windows 2000 Workstation
Professional.
2. The client is written in C++ and is produced using Visual Studio.NET
3. I am compiling with Debug and using the "rtd" versions of the OmniOrb
dlls.
4. I have produced stubs for the interface using omniidl, and complied them
into the project as
   "unmanaged" code.
5. On running the code I get a memory drain every time that I call the
interface.
6. My call on the interface looks like this:-
		(*mysql)->execute (QueryTemp,*resout,*updatecount,*corbawarnout);
Where SQLStatement_var *mysql;
      ResultSets_out	*resout;
	UpdateCounts_out *updatecount;
	CorbaSQLWarnings_out *corbawarnout;
These are allocated on class creation and deleted on class destruction,
however the memory allocated in the Unmarshal
does not seem to be released.

The stack trace at the point where the memory is lost is as follows (XXXXX
is the point where I call the interface, YYYYY
is the point where the memory is allocated.
	cdbapi.dll!_heap_alloc_dbg(unsigned int nSize=16, int nBlockUse=1, const
char * szFileName=0x100697e0, int nLine=674)  Line 356	C
 	cdbapi.dll!_nh_malloc_dbg(unsigned int nSize=16, int nhFlag=1, int
nBlockUse=1, const char * szFileName=0x100697e0, int nLine=674)  Line 260 +
0x15	C
 	cdbapi.dll!operator new(unsigned int cb=16, int nBlockUse=1, const char *
szFileName=0x100697e0, int nLine=674)  Line 48 + 0x17	C++
 	cdbapi.dll!operator new(unsigned int s=16)  Line 674 + 0x18	C++
YYYYY
cdbapi.dll!_0RL_cd_6e6ad5b46ebfccd0_00000000::unmarshalReturnedValues(cdrStr
eam & _n={...})  Line 322 + 0x7	C++
 	omniORB400_rtd.dll!67be9d73()
 	omniORB400_rtd.dll!67bcecb4()
XXXXX	cdbapi.dll!Query::_objref_SQLStatement::execute(const char *
statement=0x042e0068, TabularResults::ResultSets_out resultSets={...},
Query::UpdateCounts_out updateCount={...}, Query::CorbaSQLWarnings_out
warnings={...})  Line 396	C++
 	cdbapi.dll!CDB_API.CDB_DB::Query(String* Query = "update ...",
System.Data.DataSet Result = {System.Data.DataSet}, __int64 UpdateCount = 2,
CDB_API.clCorbaSqlWarning SQLWarnings = {CDB_API.clCorbaSqlWarning}) Line
402	C++
 	cdbapi.dll!CDB_API.CDBQuery::Query(String* __unnamed000 = "update...",
__int64 __unnamed001 = 2, CDB_API.clCorbaSqlWarning __unnamed002 =
{CDB_API.clCorbaSqlWarning}) Line 838	C++
 	Writer.exe!InstanceThread(void* lpvParam = {void},
CDB_API.clCorbaSqlWarning warn = {CDB_API.clCorbaSqlWarning}) Line 266	C++
 	Writer.exe!main(__int32 argc = 2, char** argv = {char*}) Line 90	C++
 	Writer.exe!mainCRTStartup()  Line 259 + 0x19	C

The area where the lost memory is allocated (YYYYY) is below.
void _0RL_cd_6e6ad5b46ebfccd0_00000000::unmarshalReturnedValues(cdrStream&
_n)
{
  arg_1 = new TabularResults::ResultSets;  //SUSPECT LINE Block 77
  (TabularResults::ResultSets&)arg_1 <<= _n;
  arg_2 = new Query::UpdateCounts;	// Suspect area Block 78 and 79
  (Query::UpdateCounts&)arg_2 <<= _n;
  arg_3 = new Query::CorbaSQLWarnings;	//Suspect area Block 80 & 81
  (Query::CorbaSQLWarnings&)arg_3 <<= _n;

TIA

David Vaughan
(Senior Software Engineer
Thales Information Systems)
dave.vaughan@thales-is.com
View in this posting are my own and do not represent Thales-IS