RTC Forums
November 24, 2024, 09:43:16 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
TRtcHttpClient Memory Leak When Created from a TThread
Pages: [
1
]
« previous
next »
Print
Author
Topic: TRtcHttpClient Memory Leak When Created from a TThread (Read 4652 times)
DougB
Newbie
Posts: 19
TRtcHttpClient Memory Leak When Created from a TThread
«
on:
September 08, 2014, 10:22:20 PM »
I ran into a memory leak with the RTC components when I create instances of TRtcHttpClient inside another thread.
I've created a very simple project here that reproduces the problem, including the leak report:
http://ge.tt/3LU5Kqu1/v/0
Thanks,
Doug
Logged
D.Tkalcec (RTC)
Administrator
Posts: 1881
Re: TRtcHttpClient Memory Leak When Created from a TThread
«
Reply #1 on:
September 08, 2014, 11:46:20 PM »
The Memory Leak is not a result of creating the components from a background thread. It is a result of preparing a new Request object on the TRtcDataRequest component, but NOT posting the object to the request queue.
In short, the lines in your ClientManager unit, where you are assigning values to properties of the "
fRequest.Request
" object will silently create a new Request object, which is supposed to be posted to the request queue by calling "Post", but you never do that, which leaves the object unused and results in a memory leak when the component is destroyed.
Commenting out the lines with assignments to
fRequest.Request
(in case you did not plan on posting a new request), or calling "fRequst.Post;" as the last line in your
THttpClient.Create
method (if the request object was prepared and should be put into the request queue and posted to the Server) will fix the memory leak.
Best Regards,
Danijel Tkalcec
Logged
DougB
Newbie
Posts: 19
Re: TRtcHttpClient Memory Leak When Created from a TThread
«
Reply #2 on:
September 09, 2014, 12:59:01 AM »
Thanks, that did it!
Doug
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...