How to free virtual memory ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mehdiab
    New Member
    • Jun 2010
    • 2

    How to free virtual memory ?

    I have a crawler application (with C#) that downloads pages from web . The application take more virtual memory , even i dispose every object and even use
    Code:
    GC.Collect()
    .

    This , have 10 thread and each thread has a socket that downloads pages . In each thread , i have a
    Code:
    byte[] buffer
    that store content of page , and have an
    Code:
    string str_content
    that i store in it , content of page in string . I have a Sytem.Timer that every 3 second chech , if each thread has been stopped , assign it new thread and start it.

    I use dispose method and even use
    Code:
    GC.Collect()
    in my application , but in 3 hour my application take 500 MB on virtual memory (500 MB on private bytes in Process explorer) . Then my system will be hang and i should restart my pc .

    would it be rude , If i assign my byte[] and string to null ?

    Is there any way that i use to free virtual memory ?

    Thanks .
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    GC.Collect()
    won't do you any good if you don't dispose of objects you are making. All GC.Collect does is cause garbage collection to take place 'now' instead of when the OS feels like it.

    If you memory use keeps climbing then you have a problem with not disposing of objects. That's where you need to concentrate your efforts.

    Comment

    Working...