VB.NET Memory Problems Garbage Collection Not Working?

Posted on 2005-04-16
Last Modified: 2012-08-14
I am a .NET newbie and am having a lot of memory problems.  Im primarily working with ADODB.NET and some other .NET controls for FTPing.  The utility is on a time to query a database every 10 minutes or so and executes some FTP functions based on query results.  The problem is after several hours of running memory on the box is largely consumed and Windows starts reporting paging problems and resizing.

I've cleaned up all of my objects the best I can find.  Disposing of the disposable ones and setting all other obeject and varibles to nothing after each process execution.  I've been doing some research on the GC.Collect method and have sprinkled it in some of my loops with no luck.

I have noticed that minimizing the console app cleans my memory utilization significanlty.  Just for grins, I have my time maximizing my form when it begins its processing and minimizing upon completion.  This seems to work for a while in cleaning up the memory problems but I am CERTAIN this isn't the best solution.

Let me know ANYTHING I could do to manage memory a bit better.
Question by:jimtxas

    Author Comment

    Some other noticable items....

    In checking the incremental memory utilization with minimizing the window, this doesn't appear to be working either.  It cakes memory utilization down to 2mb or so when minimized but incrementally gets larger when maximized.

    I commented out a refresh function I am calling for 2 datagrids on my form each time the app runs and the memory utilization seems somwhat stable (<1k increase per iteration) if I do not perform these refreshes.   Here's the code in my refresh...

            'myDA.Fill(myDS, "gFTP_gLOG")
            'myDA2.Fill(myDS2, "gFTP_gTRK")

            'f.DataGrid2.DataSource = myDS2.Tables(0)
            'f.DataGrid1.DataSource = myDS.Tables(0)

    What can I do to clean this up but keep my datagrids up to date?

    LVL 14

    Accepted Solution

    I usually use dataset.clear to clear all the data and then refill the dataset, not sure if that will help reduce the memory tho:
      myDA.Fill(myDS, "gFTP_gLOG")
      myDA2.Fill(myDS2, "gFTP_gTRK")


    Author Comment

    This wasn't an exact answer to my problem but it sure helped the memory consumption problem....

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now