GC does not release memory...memory keeps growing!!!

Discussion in 'ASP .Net' started by Mahesh Prasad, Dec 31, 2003.

  1. Hi,

    I'm having a very very frustrating experience with the .NET. I've a simple
    crawler console application.
    The main objective of the crawler is to read a list of URLs and make HTTP
    calls to a web server and save
    the html files locally.

    I had setup perfmon to monitor the memory usage of the application. I found
    that the Gen 2 heap size keeps increasing
    and ultimately the system runs out of memory. Whereas Gen 0 and Gen 1 heap
    size is stable (it increases and decreases as GC runs).

    I understand that the objects that have lived long enough are ultimately
    promoted to Gen 2. But none of my objects have
    that much state information to cause the Gen 2 heap to grow incessantly!!
    I'm using many temporary objects like
    HttpWebRequests, StringBuilder and Streams. But these objects live only as
    long as the HTTP request lasts. I'm not
    saving these objects as my class members.

    I would appreciate if someone can throw some light on this strange
    behaviour. I'm so frustrated that I'm planning to
    re-write the code in C++.....atleast I'll have control over when the memory
    is to be released.

    Thanks in advance.

    Mahesh
     
    Mahesh Prasad, Dec 31, 2003
    #1
    1. Advertising

  2. Mahesh Prasad

    Tom Wells Guest

    Make sure you call Dispose on all objects that have a Dispose, same with
    Close methods....



    "Mahesh Prasad" <> wrote in message
    news:%...
    > Hi,
    >
    > I'm having a very very frustrating experience with the .NET. I've a simple
    > crawler console application.
    > The main objective of the crawler is to read a list of URLs and make HTTP
    > calls to a web server and save
    > the html files locally.
    >
    > I had setup perfmon to monitor the memory usage of the application. I

    found
    > that the Gen 2 heap size keeps increasing
    > and ultimately the system runs out of memory. Whereas Gen 0 and Gen 1 heap
    > size is stable (it increases and decreases as GC runs).
    >
    > I understand that the objects that have lived long enough are ultimately
    > promoted to Gen 2. But none of my objects have
    > that much state information to cause the Gen 2 heap to grow incessantly!!
    > I'm using many temporary objects like
    > HttpWebRequests, StringBuilder and Streams. But these objects live only as
    > long as the HTTP request lasts. I'm not
    > saving these objects as my class members.
    >
    > I would appreciate if someone can throw some light on this strange
    > behaviour. I'm so frustrated that I'm planning to
    > re-write the code in C++.....atleast I'll have control over when the

    memory
    > is to be released.
    >
    > Thanks in advance.
    >
    > Mahesh
    >
    >
     
    Tom Wells, Feb 22, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Clement
    Replies:
    7
    Views:
    1,662
    Kevin Spencer
    Jul 3, 2003
  2. Hoon
    Replies:
    1
    Views:
    511
    John Timney \(Microsoft MVP\)
    Jul 3, 2003
  3. aarg
    Replies:
    4
    Views:
    2,601
  4. Aaron Reimann

    CSS help (boxes not "growing")

    Aaron Reimann, Oct 12, 2005, in forum: HTML
    Replies:
    1
    Views:
    450
    Aaron Reimann
    Oct 12, 2005
  5. saurabh9
    Replies:
    2
    Views:
    604
    Bergamot
    Oct 10, 2008
Loading...

Share This Page