Re: .NET eats memory like a pig

Tech-Archive recommends: Fix windows errors by optimizing your registry



> Thre is no code!
>
> Just write a win form app that connects to Access or SQL server, open the
> connection and closes it, you app will take between 15 to 20M

Well, I'd call what you've stated above some code. Let's see exactly what
you wrote because if I write code that does what you suggest, it doesn't
come anywhere near the memory usage you are experiencing.

> Belive me I have coded my application very carefully and when I talk about
> refrence couting I don't mean COM, I mean I make sure there are zero
> refrences for an object, so the GC can collect it.

Although you say that I should "believe you" that you've coded carefully,
you continue to give us no examples of what you are doing. And, since I've
used .NET since early betas (nearly 4 years now) and have not experienced
what you are experiencing but have seen what you describe over and over
again with code that is not written properly, I'm going to have a hard time
just "beliving" that you are doing everything correctly.

It almost sounds like you don't want to solve your problem and would just
prefer to complain about .NET. Let's see your code!

>
> "Scott M." <s-mar@xxxxxxxxxxxxx> wrote in message
> news:um%23VrsIoFHA.860@xxxxxxxxxxxxxxxxxxxxxxx
>> Well, from your comments it sounds like you might not fully understand
>> how
>> memory is managed in .NET. .NET does NOT use reference counters like COM
>> applications do.
>>
>> Ultimately, it's not the Framework that is tying up memory, it is your
>> application. In any programming environment, if you write sloppy code,
> you
>> get poor performance. I'd start by examine your code and make sure you
> are
>> calling Dispose on any object that uses unmanaged resources, call Close
>> on
>> any object that is opened, manage any multi-threading you may be doing
> with
>> a watchful eye, use the Marshall.ReleaseComObject class to allow the
>> Framework to release its references to any and ALL COM objects you may be
>> using, set the ASPCompat property of ASP.NET pages to True when using COM
>> objects in ASP.NET pages, etc. etc.
>>
>> In short, before you beat up on the platform, examine what you are doing
> in
>> that platform. You haven't told us anything about the code you are
>> attempting to run. If you do, we can get a feel for how we may be able
>> to
>> help or point you in the right learning direction.
>>
>>
>> "Mike P" <m_peretz@xxxxxxxxxxx> wrote in message
>> news:29vLe.17198$yH2.905547@xxxxxxxxxxxxxxxxxxxxxxxx
>> >I know everything about reference counting and making sure you don't
>> >have
>> > large objects lying around. I have also profiled my app with multiple
>> > tools.
>> > I know about the fact GC collects memory but not necessary give it back
> to
>> > the OS.
>> >
>> >
>> >
>> > It seems that .NET win app will only return memory to the OS when the
>> > OS
>> > is
>> > asking for it. But!!! When the OS is asking for it is usually too late,
>> > tons
>> > of swapping and slow performance.
>> >
>> >
>> >
>> > I just don't get it, how can .NET a superior technology is eating so
> much
>> > RAM? I see that some people force their app to minimize or trim their
>> > workspace just to free the memory - that is a bad idea. Other people
>> > unload
>> > a application domain to save memory... a little better but still lots
>> > of
>> > work just to get some memory back to the OS.
>> >
>> >
>> >
>> > Some people tell me it is the price to pay for a runtime. Sorry, I have
>> > used
>> > other runtimes for windows applications and they don't eat so much
> memory.
>> > For the love of god, AcuCobol runtime does not take so much RAM (not
> that
>> > I
>> > want to code in COBOL now)
>> >
>> >
>> >
>> > At the end, it seems it is like running an OS within an OS. I am
>> > frustrated
>> > that a stupid windows application can take 20M for doing nothing, and
>> > if
>> > you
>> > have an app that does a little more stuff, it can take 40M and you have
> to
>> > worry about each Dispose and reference so it will not jump to 100M.
>> >
>> >
>> >
>> > and I am not alone with this problem....
>> >
>> >
>> >
>> >
> http://www.dotnet247.com/247reference/a.aspx?u=http://weblogs.asp.net/pwilson/archive/2004/02/14/73033.aspx
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>
>>
>
>


.



Relevant Pages

  • Re: .NET eats memory like a pig
    ... > Just write a win form app that connects to Access or SQL server, ... >> memory is managed in .NET. ... .NET does NOT use reference counters like COM ... >>> other runtimes for windows applications and they don't eat so much ...
    (microsoft.public.dotnet.general)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... Of course, if you use 8GB of RAM, or more precisely if you ... Are you saying that if I have a 4GB RAM memory, ... Linux will somehow "know" that it doesn't have ... You've said in another message that your app is ...
    (comp.os.linux.setup)
  • Re: How to set up a Linux machine that occupies the minimum memory footprint ?
    ... Of course, if you use 8GB of RAM, or more precisely if you ... Are you saying that if I have a 4GB RAM memory, ... Linux will somehow "know" that it doesn't have ... You've said in another message that your app is ...
    (comp.os.linux.misc)
  • Re: .NET eats memory like a pig
    ... Just write a win form app that connects to Access or SQL server, ... > memory is managed in .NET. ... .NET does NOT use reference counters like COM ... >> other runtimes for windows applications and they don't eat so much ...
    (microsoft.public.dotnet.general)
  • Re: need a thumbnail browser without memory limitations
    ... When you are working with media files, you need to decide how you are going to limit the memory requirements of your app. ... For display pictures, you can take approaches that limit the memory requirements such as minimal caching. ... lets say you need to load the next 10 thumbnails as the user scrolls. ...
    (microsoft.public.vb.general.discussion)