0 votes
by (120 points)
edited

Dear All,

we are trying the FTP/SSL library for .NET Compact Framework, which seems to be ok for our vending machine application.

The library is very nice, but if we make a stress-test we can see a memory leak....

Of course, we didn't allocate memory at runtime, we have done the following things:

1 - Create Ftp item
2 - On a Timer Tick (tick every 30 seconds) we do:

  • ftp.Connect(); and ftp.Login(..) to server
  • ftp.GetList(); Function to retrieve the remote files/folders List
  • Upload a File (about 500Kb) with ftp.PutFile(..) function
  • Download the uploaded file with ftp.GetFile(..) function
  • Rename the uploaded (remote) file with ftp.Rename(..) function
  • Delete the uploaded (remote) file with ftp.DeleteFile(..) function
  • Disconnect();

In about 1 Day we can see the memory goes down of about 10Mbytes, and it it very strange... Of course we cannot use the library in this mode..

Any suggestion? There are some objects that we must free from memory manually?

Thank You in advance Best Regards Simone Arianti

by (58.9k points)
edited

See the answer at http://forum.rebex.net/questions/3037/ftp-ssl-memory-leak-on-compact-framework-3-5/3040. If you still observe the decrease in free memory using either our or your stress test, please let us know and we will investigate further.

by (58.9k points)
edited

And as to your question, no you are not supposed to free any objects manually from memory with Rebex components.

2 Answers

0 votes
by (58.9k points)
edited

Hello,

thank you for reporting this issue to us!

I tried, but I was not able to reproduce the leak myself. I could have missed something, so could you please provide us with the source code you deployed for the stress test and with the information about the device and OS on which you observed the problem? That might help us to tell what's going on with the free memory. You can send the source to support@rebex.net or post it here. Thanks!

0 votes
by (58.9k points)
edited

Thank you for your stress test source code you have sent to us by email. We have tested it for 14 hours (perform the stress test every 1/10 of second or so) and could not see the memory leak. We have also deployed our stress test code and tested it also for several hours and have discovered no memory leak in Rebex Ftp class:

        using System;
        using System.Threading;
        using System.IO;

        using Rebex.Net;

        namespace FtpMemoryLeakTest
        {
            class Program
            {
                static void Main(string[] args)
                {
                    /*1 - Create Ftp item 
                    2 - on a Timer Tick (tick every 30 seconds) 
                        a - ftp.Connect(); and ftp.Login(..) to server 
                        b - ftp.GetList(); Function to retrieve the remote files/folders List 
                        c - Upload a File (about 500Kb) with ftp.PutFile(..) function 
                        d - Download the uploaded file with ftp.GetFile(..) function 
                        e - Rename the uploaded (remote) file with ftp.Rename(..) function 
                        f - Delete the uploaded (remote) file with ftp.DeleteFile(..) function 
                        g - Disconnect();*/

                    Ftp ftp = new Ftp();

                    string file = "test.file";
                    string renFile = "testRen.file";

                    string uploadDir = "/incoming/";

                    string remoteFile = uploadDir + file;
                    string remoteRenamedFile = uploadDir + renFile;

                    string localDir = "Storage Card\\";
                    string localFile = localDir + file;
                    string localRenamedFile = localDir + renFile;

                    while (true)
                    {
                        //a
                        ftp.Connect("server", 21);
                        ftp.Login("user", "password");
                        //b
                        ftp.GetList();
                        //c 
                        ftp.PutFile(localFile, remoteFile);
                        //d
                        ftp.GetFile(remoteFile, localFile);
                        //e
                        ftp.Rename(remoteFile, remoteRenamedFile);
                        //f
                        ftp.DeleteFile(remoteRenamedFile);
                        // g
                        ftp.Disconnect();

                        Thread.Sleep(100);
                    }
                }
            }
        }
...