EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Correct way for release TElHTTPSClient object

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#37626
Posted: 09/05/2016 04:18:08
by shawn jun (Basic support level)
Joined: 04/12/2016
Posts: 9

I've setup a simple testing for periodically create a TElHTTPSClient object in a Timer, and access a https url, finally Close(true) it by following your sample code, by monitoring the Memory counter (Virtual Memory and WorkingSet) for this process, I can see these counters keep rising and getting over 10 times than initial values (it will grows more if test lasting).
Later I add the Dispose() call besides the 'Close(true)', those 2 counters are getting fine.
And I noticed there're another function of 'Destroy()', did I need to call this as well?

key code for testing:

Code
private TElHTTPSClient HTTPSClient = null;
        private void timer1_Tick(object sender, EventArgs e)
        {
            try
            {
                timer1.Stop();
                HTTPSClient = new SBHTTPSClient.TElHTTPSClient();
                // Client Only Production Key
                SBUtils.Unit.SetLicenseKey("XXXXX omit here XXXXXX");
                HTTPSClient.OnData += new SBSSLCommon.TSBDataEvent(HTTPSClientOnData);

                string url = "https://www.msn.com/";
                int res = HTTPSClient.Get(url);

                timer1.Start();
            }
            catch (Exception ex)
            {                
                timer1.Start();
            }
            finally
            {
                HTTPSClient.Close(true);
                // adding by my guess
                HTTPSClient.Dispose();
                // did i need call this as well?
                // HTTPSClient.Destroy();
            }
        }

        private void HTTPSClientOnData(object Sender, byte[] buffer)
        {
        }

        static void Main(string[] args)
        {
            timer1.Start();
            Console.ReadLine();
        }


VERSION we used:
SecureBlackbox.HTTP, Version=14.0.290.0, Culture=neutral, PublicKeyToken=5a62fa96d0ac43

Regarding the support ticket, our company might lost the registration email, and Only I can provide is the license key, does that help?
#37627
Posted: 09/05/2016 04:22:03
by Vsevolod Ievgiienko (EldoS Corp.)

Thank you for contacting us.

Calling Dispose after Close is enough to free allocated memory correctly.

Reply

Statistics

Topic viewed 214 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!