Article View: borland.public.cppbuilder.database.multi-tier
Article #420About TVariant and memory allocation in RPC
From: Mountain Lan
Date: Mon, 08 Jul 2002 08:13
Date: Mon, 08 Jul 2002 08:13
50 lines
2518 bytes
2518 bytes
Hi, guys,
I've developed a program using BCB5 and COM+. I found that the middle-tire
isn't stable after running for a long time, an error message 'Abnormal
program terminated' was reported in the host server, and the 'dllhost.exe'
process was shutdowned. I wrote a test client and and test server to find
out the problem. If the client invokes a RPC which returns a TVariant value
from the middle-tire, everytime the client calls the COM+ object, memory
exhausted by 'dllhost.exe' process increases. I think maybe this is the
reason.
My test program is so simple.
Client:
conServer->Open();
for (int intCounter = 0; intCounter < 10000; intCounter ++)
{
ITestDisp TestInterface = (ITest*)(IDispatch*)conServer->AppServer;
WideString strTemp = "ValueIn";
TVariant objValueIn = strTemp;
TVariant objValue;
OleCheck(TestInterface.TestRobust(objValueIn, objValueOut));
}
conServer->Close();
Server:
STDMETHODIMP TTestImpl::TestRobust(TVariantInParam ValueIn,
TVariant* ValueOut)
{
TVariant objIn = ValueIn;
WideString strValueIn = objIn;
WideString strValueOut = strValueIn + "Out";
TVariant objOut = strValueOut;
*ValueOut = objOut;
return S_OK;
}
By the way, I've modified the source file 'mtshlpr.cpp' and added it to my
project. This modification is necessary according to bug report. Otherwise,
the COM+ object will crash when invoked.
What's wrong in my program? I've tried to write it with Delphi6, and I
noticed that memory in the server is released normally. I am longing for the
answer.
Thanks!
Mountain Lan
Technical Details
Message-ID:
<3d2949e5_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcd2b,dabb0ba8a7691f4d,start X-Google-Attributes: gidfcd2b,public X-Google-ArrivalTime: 2002-07-08 01:16:50 PST Reply-To: "Mountain Lan" <swatow@sina.com> From: "Mountain Lan" <swatow@sina.com> Newsgroups: borland.public.cppbuilder.database.multi-tier Subject: About TVariant and memory allocation in RPC Date: Mon, 8 Jul 2002 16:13:24 +0800 Lines: 55 Organization: Ideal Tech X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 61.164.162.65 Message-ID: <3d2949e5_1@dnews> X-Trace: dnews 1026116069 61.164.162.65 (8 Jul 2002 01:14:29 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!iad-peer.news.verio.net!news.verio.net!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews