I don't think it's related to the Temperature Service because I wrote a
very simple service (random number generator) that exhibits the same
problem. I tried to access Nick's Shakespeare service (just to use the
"standard" one that a lot of us cut our teeth on) but I can't seem to
reach his server from here at this moment in time.
An example of the call is simply this:
Temperature := (HTTPRIO1 as TemperaturePortType).getTemp('98052');
Each call adds 12K to the apps memory usage. I see this using the Windows
NT Task Manager.
Anyone have any similar experiences or ideas about what's going on?
--
Matthew Mead
Integrate Java and Delphi
www.pacifier.com/~mmead/jni/delphi
Task Manager is not a reliable guide for checking memory leaks.
Use something like memproof.
--
Dave Nottage
I understand that Task Manager is not accurate, but is it really possible it's
this inaccurate? The app starts up at about 4 MB and 4 hours later Task Manager
says it's using 50 MB. I've never seen this problem so severe with any other
app.
I also may have mislead by saying it's a memory leak. It may not be a leak in
the true sense, but rather, I need to explicitly free something between calls.
BTW, I don't recall memproof? Is it free? Where can I get it? I also read on
these newsgroups that some people have used THeapStatus and GetHeapStatus to
detect leaks. Maybe I should try that as well.
Thanks. It looks like I'm out of luck with this, though, as it doesn't yet
support D6.
http://www.automatedqa.com/downloads/memproof.asp
--
Dave Nottage
Matthew Mead wrote:
>
> Needless to say, after a few hours with several cities, the program
> is using several megabytes of memory.
>
> An example of the call is simply this:
>
> Temperature := (HTTPRIO1 as TemperaturePortType).getTemp('98052');
Thank you Matthew,
I've submitted this issue to the "Borland Bug DB" for further
investigation.
_shane
Shane, I take it that you believe this is truly a bug in the
implementation and not in the way that I am using it? If it isn't a bug, I
would be very concerned as I believe I am using it in the proper fashion.
Unfortunately, this "bug" is preventing me from creating several web
service clients (that run in the system tray) and access web services
frequently.
> The problem I'm having is that every call on the HTTPRIO object results
> in an additional memory consumption
I can confirm that I see the same behaviour in my web services (like
TicTacToe and HitchHiker)...
> Matthew Mead
Groetjes,
Bob Swart (aka Dr.Bob - www.DrBob42.com)
--
drs. Robert E. (Bob) Swart - Consultant, Delphi Trainer & Author
UK-BUG Borland User Group Member & Borland UK Connections Member
Thanks, Dr. Bob. You are the second person that has confirmed this for
me. On one hand, I'm glad that it wasn't leaking because of the way I was
using it, but on the other, it seems to be a pretty serious bug in the
implementation that will affect any client making numerous calls.
Shane Hausle has indicated in this thread that he has submitted this bug
to Borland for further investigation. Maybe I can figure out some work-
around in the mean time.
Regards,
> In article <3B5479C2...@chello.nl>, dr...@chello.nl says...
>> > The problem I'm having is that every call on the HTTPRIO object
>> > results in an additional memory consumption
>>
>> I can confirm that I see the same behaviour in my web services (like
>> TicTacToe and HitchHiker)...
>
> Thanks, Dr. Bob. You are the second person that has confirmed this for
> me.
Let me be the third. Even on a simple "Hello World" web service.
--
- Jimmy -
-------------------------------------------
- http://www.used-disks.com/Programming/ -
- http://www.insider-info.com/Music/Boetz -
-------------------------------------------
- No direct email unless requested -
:
----------------------------------------
Robert T. Howell
rob...@roberthowell.com
----------------------------------------
Please change your code to:
var
Srv : TemperaturePortType;
Tempereature : Integer; {(or float, I don't really know)}
begin
Srv := HTTPRIO1 as TemperaturePortType;
Temperature := Srv.getTemp ('98052');
Srv := nil;
end;
The way you are writing, the reference to the WebService "client" structure
is not being released. This is done in the Srv:= nil part of my code.
Cheers,
Daniel.
Daniel Polistchuck
QualTech IT - Brazil
dan...@qualtech.com.br
"Matthew Mead" <mm...@nospam.pacifier.com> wrote in message
news:MPG.15b6fae1c...@forums.borland.com...
Make the following change:
destructor THTTPReqResp.Destroy;
begin
// start of added code
if Assigned(FInetConnect) then
InternetCloseHandle(FInetConnect);
FInetConnect := nil;
if Assigned(FInetRoot) then
InternetCloseHandle(FInetRoot);
FInetRoot := nil;
// end of added code
inherited;
end;
Making this change has eliminated the 12k memory leak for me.
Best Regards
Mark
I have noted a memory leakage in THTTPRio (I think).
On my client it leaks 10-16k memory and 4 handles in each call to a webservice.
The webservice is a simple test service I wrote when I noticed this problem
It only doubles the incoming value.
My client call is like this:
var
inVal,outVal : Integer;
testSrv : ITestSrv;
begin
testSrv := rioTestSrv as ITestSrv;
testSrv.doubleValue(StrToInt(edtVal.Text),outVal);
edtVal.Text := IntToStr(outVal);
testSrv := nil;
end;
I Created the THTTPRio component in some different ways, but it didn't matter.
I also noted that if i created it with no owner (nil), then the second call to the server produced an access violation.
Is there someone else who has noted this leakage?
(My machine runs on NT 4.0)
------
Klas Fischer
System Developer
Ericsson Microwave Systems
WebService := (HTTPRIO1 as IServerObjects);
label1.caption := WebService.SayHello;
WebService := nil;
And it still leaks memory.
We worked around the problem by closing the connection after each method
invocation:
HTTPRIO1.HTTPWebNode.Connect(true);
WebService := (HTTPRIO1 as IServerObjects);
label1.caption := WebService.SayHello;
HTTPRIO1.HTTPWebNode.Connect(false);
However, there must be a better workaround than this. Any ideas?
"Klas Fischer" <klas.f...@emw.ericsson.se> wrote in message
news:3b835d55$1_1@dnews...
Me too, it leaks about 12k in each call.
There is a bug in SoapHTTPTrans.pas:
procedure THTTPReqResp.Execute(const DataMsg: WideString; Resp: TStream);
...
begin
...
Context := Send(DataMsg);
Receive(Context, Resp);
end;
function THTTPReqResp.Send(const S: WideString): Integer;
...
begin
if UseUTF8InHeader then
ContentHeader := ContentHeaderUTF8
else
ContentHeader := ContentHeaderNoUTF8;
if not FConnected then
begin
Connect(True);
FConnected := True;
end;
SetLength(AcceptTypes, 3);
AcceptTypes[0] := PChar('application/octet-stream');
AcceptTypes[1] := PChar('text/xml');
AcceptTypes[2] := nil;
Flags := INTERNET_FLAG_KEEP_CONNECTION or INTERNET_FLAG_NO_CACHE_WRITE;
if FURLScheme = INTERNET_SCHEME_HTTPS then
Flags := Flags or INTERNET_FLAG_SECURE;
// !!!!!!!!!!!! Create a handle but never close it !!!!!!!!!!!!!!!!!!
Request := HttpOpenRequest(FInetConnect, 'POST', PChar(FURLSite), nil,
nil, Pointer(AcceptTypes), Flags, Integer(Self));
Check(not Assigned(Request));
// Add try..except by Q.Sheng 09.02.2001
try
if FSoapAction = '' then
ActionHeader := SHTTPSoapAction + ':'
else
ActionHeader := SHTTPSoapAction + ': ' + '"' + FSoapAction + '"';
HttpAddRequestHeaders(Request, PChar(ActionHeader),
Length(ActionHeader), HTTP_ADDREQ_FLAG_ADD);
HttpAddRequestHeaders(Request, PChar(ContentHeader),
Length(ContentHeader), HTTP_ADDREQ_FLAG_ADD);
WireData := UTF8Encode(S);
while True do
begin
Check(not HttpSendRequest(Request, nil, 0, @WireData[1],
Length(WireData)));
RetVal := InternetErrorDlg(GetDesktopWindow(), Request, GetLastError,
FLAGS_ERROR_UI_FILTER_FOR_ERRORS or
FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS or
FLAGS_ERROR_UI_FLAGS_GENERATE_DATA, P);
case RetVal of
ERROR_SUCCESS: break;
ERROR_CANCELLED: SysUtils.Abort;
ERROR_INTERNET_FORCE_RETRY: {Retry the operation};
end;
end;
Result := Integer(Request);
except
InternetCloseHandle(Request);
raise;
end; // End try..except
end;
procedure THTTPReqResp.Receive(Context: Integer; Resp: TStream);
...
begin
// Add try..finally by Q.Sheng 09.02.2001
try
Len := SizeOf(Status);
Index := 0;
if HttpQueryInfo(Pointer(Context), HTTP_QUERY_STATUS_CODE or
HTTP_QUERY_FLAG_NUMBER,
@Status, Len, Index) and (Status >= 300) then
begin
Index := 0;
Size := MaxStatusTest;
SetLength(S, Size);
if HttpQueryInfo(Pointer(Context), HTTP_QUERY_STATUS_TEXT, @S[1],
Size, Index) then
begin
SetLength(S, Size);
raise Exception.CreateFmt('%s (%d)', [S, Status]);
end;
end;
Len := 0;
repeat
Check(not InternetQueryDataAvailable(Pointer(Context), Size, 0, 0));
if Size > 0 then
begin
SetLength(S, Size);
Check(not InternetReadFile(Pointer(Context), @S[1], Size,
Downloaded));
Resp.Write(S[1], Size);
end;
until Size = 0;
finally
InternetCloseHandle(Pointer(Context)); <-------- This is why leaks
memory with every call
end; // End try..finally
end;
Good luck! :-)
Qiang Sheng
s...@sharella.com
"David Morgereth" <dmorg...@costargroup.com> wrote in message
news:3b8be8ad_1@dnews...