How to handle memory allocation i shared hosting environments? (GC.Collect)

Discussion in 'ASP .Net' started by jdlwright@gmail.com, Jun 12, 2006.

  1. Guest

    Hi, a customer is using our fairly memory intensive web app. in a
    shared hosting environment
    and the other day their host 'banned' (I think they just killed the
    process) them for memory abuse.

    Our app. has been profiled with SciTech's Mem Profiler, and it seems
    that some of the issues relate to .NET bugs, but are alleviated by use
    of System.GC.Collect(). I'm under the impression that it's generally
    bad form to call this yourself, but at the same time, it strikes me
    that the GC probably doesnt realise it's in a shared hosting
    environment and there is happy to use up as much memory as it likes.
    Possibly the host could do a better job of configuration(?), but that
    doesnt really help much since we can't go around telling customers to
    tell their hosts to sort out their config -> good way to lose a
    customer.

    So question is; what are the cons of calling Collect(), are they just
    speed related?

    Any tips would be welcome

    Thanks
    Jim
     
    , Jun 12, 2006
    #1
    1. Advertising

  2. I say go ahead and call GC.Collect sparingly. That's why it's there.
    It does use significant CPU cycles so don't call it very often or it could
    degrade performance.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://SteveOrr.net


    <> wrote in message
    news:...
    > Hi, a customer is using our fairly memory intensive web app. in a
    > shared hosting environment
    > and the other day their host 'banned' (I think they just killed the
    > process) them for memory abuse.
    >
    > Our app. has been profiled with SciTech's Mem Profiler, and it seems
    > that some of the issues relate to .NET bugs, but are alleviated by use
    > of System.GC.Collect(). I'm under the impression that it's generally
    > bad form to call this yourself, but at the same time, it strikes me
    > that the GC probably doesnt realise it's in a shared hosting
    > environment and there is happy to use up as much memory as it likes.
    > Possibly the host could do a better job of configuration(?), but that
    > doesnt really help much since we can't go around telling customers to
    > tell their hosts to sort out their config -> good way to lose a
    > customer.
    >
    > So question is; what are the cons of calling Collect(), are they just
    > speed related?
    >
    > Any tips would be welcome
    >
    > Thanks
    > Jim
    >
     
    Steve C. Orr [MVP, MCSD], Jun 12, 2006
    #2
    1. Advertising

  3. if GC.Collect() helps, then you probably are not calling Dispose() when you
    are supposed to, so you are not releasing unmanged memory as early as
    possible.

    If you are using com interop, then you probably are not releaseing the com
    objects with calls to ReleaseComObject, or are using double dot notion
    (myobject.a.b) which will cause excessive use of memory (again the com
    object is not dereferenced when done, so it hangs on to unmanaged memory)

    -- bruce (sqlwork.com)


    <> wrote in message
    news:...
    > Hi, a customer is using our fairly memory intensive web app. in a
    > shared hosting environment
    > and the other day their host 'banned' (I think they just killed the
    > process) them for memory abuse.
    >
    > Our app. has been profiled with SciTech's Mem Profiler, and it seems
    > that some of the issues relate to .NET bugs, but are alleviated by use
    > of System.GC.Collect(). I'm under the impression that it's generally
    > bad form to call this yourself, but at the same time, it strikes me
    > that the GC probably doesnt realise it's in a shared hosting
    > environment and there is happy to use up as much memory as it likes.
    > Possibly the host could do a better job of configuration(?), but that
    > doesnt really help much since we can't go around telling customers to
    > tell their hosts to sort out their config -> good way to lose a
    > customer.
    >
    > So question is; what are the cons of calling Collect(), are they just
    > speed related?
    >
    > Any tips would be welcome
    >
    > Thanks
    > Jim
    >
     
    bruce barker \(sqlwork.com\), Jun 13, 2006
    #3
  4. Guest

    bruce barker (sqlwork.com) wrote:
    > if GC.Collect() helps, then you probably are not calling Dispose() when you
    > are supposed to, so you are not releasing unmanged memory as early as
    > possible.



    I wish that were the case, but no, it's a 'bug' in the framework

    http://dturini.blogspot.com/2004/06/on-past-few-days-im-dealing-with-some.html

    calling Collect helps keep the total usage down (according to my
    profiler).


    Jim
     
    , Jun 13, 2006
    #4
    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. Ken
    Replies:
    24
    Views:
    3,930
    Ben Bacarisse
    Nov 30, 2006
  2. chris
    Replies:
    6
    Views:
    1,019
    chris
    Oct 28, 2005
  3. Dinis Cruz
    Replies:
    0
    Views:
    188
    Dinis Cruz
    Oct 30, 2003
  4. John Snowdon
    Replies:
    1
    Views:
    111
    Jano Svitok
    Mar 1, 2008
  5. teo1991
    Replies:
    0
    Views:
    650
    teo1991
    Apr 2, 2009
Loading...

Share This Page