473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Memory problem

I've got this issue:
When I start my application it takes a lot of memory. I guess this is caused
by CLR.
That's fine. But every time the app performs an action (open new form, load
data in dataset, something, it doesn't matter) the memory used by the
application increases. After using it half an hour it grows so big that most
of PCs here act very slowly.

Is this behavior caused somehow by my lack of programming knowledge or
something else?
Nov 21 '05 #1
13 1487
In article <ua**************@TK2MSFTNGP14.phx.gbl>, Nikolay Petrov wrote:
I've got this issue:
When I start my application it takes a lot of memory. I guess this is caused
by CLR.
That's fine. But every time the app performs an action (open new form, load
data in dataset, something, it doesn't matter) the memory used by the
application increases. After using it half an hour it grows so big that most
of PCs here act very slowly.

Is this behavior caused somehow by my lack of programming knowledge or
something else?


It sounds like a resource leak - if the memory is not being released.
What version of the framework are you using? I know in 1.0 (pre-sp1, I
think) there was a memory leak caused by runtime when dealing with large
objects. I've also seen reference to some other mem leak bugs in the
framework - but they seem a little obscure... I would make sure that
you are releasing all references to module level objects and that you
are calling Dispose on any objects that implement IDisposable.

--
Tom Shelton [MVP]
Nov 21 '05 #2
What are you using to see this memory leak.

Task manager is not a good indicator.

"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:ua**************@TK2MSFTNGP14.phx.gbl...
I've got this issue:
When I start my application it takes a lot of memory. I guess this is caused by CLR.
That's fine. But every time the app performs an action (open new form, load data in dataset, something, it doesn't matter) the memory used by the
application increases. After using it half an hour it grows so big that most of PCs here act very slowly.

Is this behavior caused somehow by my lack of programming knowledge or
something else?

Nov 21 '05 #3
I am using task manager to watch the memory usage.
Also I am using .NET Framework 1.1 SP1 - latest
And I don't think it is a memory leak or something?
Even on simpliest app with a two forms and a button where it is used to open
the second form. nothing else in the app I see this behavior.
I am calling the dispose method but it doesn't matter.

"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:ua**************@TK2MSFTNGP14.phx.gbl...
I've got this issue:
When I start my application it takes a lot of memory. I guess this is caused by CLR.
That's fine. But every time the app performs an action (open new form, load data in dataset, something, it doesn't matter) the memory used by the
application increases. After using it half an hour it grows so big that most of PCs here act very slowly.

Is this behavior caused somehow by my lack of programming knowledge or
something else?

Nov 21 '05 #4
On Fri, 10 Sep 2004 08:38:56 +0300, Nikolay Petrov wrote:
I am using task manager to watch the memory usage.
Also I am using .NET Framework 1.1 SP1 - latest
And I don't think it is a memory leak or something?
Even on simpliest app with a two forms and a button where it is used to open
the second form. nothing else in the app I see this behavior.
I am calling the dispose method but it doesn't matter.

"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:ua**************@TK2MSFTNGP14.phx.gbl...
I've got this issue:
When I start my application it takes a lot of memory. I guess this is

caused
by CLR.
That's fine. But every time the app performs an action (open new form,

load
data in dataset, something, it doesn't matter) the memory used by the
application increases. After using it half an hour it grows so big that

most
of PCs here act very slowly.

Is this behavior caused somehow by my lack of programming knowledge or
something else?


Nikolay... It sounds like your just observing the affects of windows
memory allocation... It always allocates more to a process then is
necessary to avoid more allocations later on (memory allocations are
expensive). If you minimize your form (before you do anything else) - you
will probably see a decrease in memory usage...

--
Tom Shelton [MVP]
Nov 21 '05 #5
You are right, after minimize the app and the maximize it again the memory
usage drop.
But after that things are the same - every click on form controls takes
memory and after some time the memory usage increases significantly. How to
prevent this behavior? I am not going to tell users to minimize thier app
from time to time. It's kind of silly.
"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:cn*****************************@40tude.net...
On Fri, 10 Sep 2004 08:38:56 +0300, Nikolay Petrov wrote:
I am using task manager to watch the memory usage.
Also I am using .NET Framework 1.1 SP1 - latest
And I don't think it is a memory leak or something?
Even on simpliest app with a two forms and a button where it is used to open the second form. nothing else in the app I see this behavior.
I am calling the dispose method but it doesn't matter.

"Nikolay Petrov" <jo******@mail.bg> wrote in message
news:ua**************@TK2MSFTNGP14.phx.gbl...
I've got this issue:
When I start my application it takes a lot of memory. I guess this is

caused
by CLR.
That's fine. But every time the app performs an action (open new form,

load
data in dataset, something, it doesn't matter) the memory used by the
application increases. After using it half an hour it grows so big that

most
of PCs here act very slowly.

Is this behavior caused somehow by my lack of programming knowledge or
something else?


Nikolay... It sounds like your just observing the affects of windows
memory allocation... It always allocates more to a process then is
necessary to avoid more allocations later on (memory allocations are
expensive). If you minimize your form (before you do anything else) - you
will probably see a decrease in memory usage...

--
Tom Shelton [MVP]

Nov 21 '05 #6
Nikolay,

The garbage collector collects when it is needed. When you use a form and
two buttons made by the formdesigner than Idisposable is implemented and
there should be no need to use dispose, because that is where Idisposable is
for. That there is memory used should not be of any reason why your program
is going slow, although the gc cleans (in my situation) I have seen even
when there is showed something to the screen.

However when you make by instance a routine like this,
\\\
private frmarray as new arraylist
dim frm as frm
frmarraylist.add(frm)
frm.open
///
You can be sure that this will create a lot of forms and never clean the
memory and the resources until you have removed the form from the arraylist
because it still has a reference.

http://msdn.microsoft.com/architectu...l/scalenet.asp

I hope this gives an idea?

Cor
Nov 21 '05 #7
On Fri, 10 Sep 2004 09:17:18 +0300, Nikolay Petrov wrote:
You are right, after minimize the app and the maximize it again the memory
usage drop.
But after that things are the same - every click on form controls takes
memory and after some time the memory usage increases significantly. How to
prevent this behavior? I am not going to tell users to minimize thier app
from time to time. It's kind of silly.


You don't have to... The behavior I was pointing out is not specific to
..NET applications. That is the way windows memory allocation works. A
process when first started is granted a larger working set then it is
expected to be used (to speed up future memory allocations). When the app
is minimized the OS reduces that working set - since the application is no
longer being used by the user.

Now, as for the growing memory... Again, you've got two main forces at
work here. You have the fact that .NET is a gc based system - which means
that memory for objects is not immediately returned to the OS. Objects are
reclaimed during a gc cycle, which is triggered when memory pressure
reaches a certain threashold. The second main factor is again - windows
memory managment. When memory that is being used by an application is
returned to the system - the, system does not necessarily remove it from
the processes working set. Again, this is because the OS figures the
process might want to allocate memory again - so, it can just reuse that
which is already allocated. If the OS needs the memory for other
applications, it will take it...

Basically, what I'm saying is that though, in general .NET apps have a
larger foot - it is not something you should be worrying about unless it is
continuing to grow without bounds and causing applications to crash due to
resource errors - this situation would be a result of a resource leak
(which is usually the result of improper management of unmanaged
resources). And in that case, you would probably want to employ a
profiling tool of some sort to help you locate the cause of the problem.

--
Tom Shelton [MVP]
Nov 21 '05 #8
Did everyone else miss what I said. Task manager is a VERY bad tool for
determinng memory allocation within .NET. That's why you have to use the
profiler. .NET Memory profiler is an excellent tool to give accurate
results (as well as see what classes are leaking).

And.. if your using any Component One Controls, thats where your leak
probably is..Because C1 Controls are garbage.

-CJ

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Nikolay,

The garbage collector collects when it is needed. When you use a form and
two buttons made by the formdesigner than Idisposable is implemented and
there should be no need to use dispose, because that is where Idisposable is for. That there is memory used should not be of any reason why your program is going slow, although the gc cleans (in my situation) I have seen even
when there is showed something to the screen.

However when you make by instance a routine like this,
\\\
private frmarray as new arraylist
dim frm as frm
frmarraylist.add(frm)
frm.open
///
You can be sure that this will create a lot of forms and never clean the
memory and the resources until you have removed the form from the arraylist because it still has a reference.

http://msdn.microsoft.com/architectu...l/scalenet.asp
I hope this gives an idea?

Cor

Nov 21 '05 #9
Hi CJ,

Did I deny that with my text, I could have told it again, however did it
that often and you did that already, when I had not agreed with you I would
have put a friendly message at your message, be not afraid of that.

My message was especially not about the memory, but about the performance
my very dear friend (not sarcastic)).

:-)

Cor
Did everyone else miss what I said. Task manager is a VERY bad tool for
determinng memory allocation within .NET. That's why you have to use the
profiler. .NET Memory profiler is an excellent tool to give accurate
results (as well as see what classes are leaking).

And.. if your using any Component One Controls, thats where your leak
probably is..Because C1 Controls are garbage.

Nov 21 '05 #10
Fair enough cor,

I wasn't saying it in anger in any way.. just seemed that some people were
focusing on task manager being a tool to do memory usage off of.

I know your not sarcastic. It's all good. =)
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uw*************@TK2MSFTNGP11.phx.gbl...
Hi CJ,

Did I deny that with my text, I could have told it again, however did it
that often and you did that already, when I had not agreed with you I would have put a friendly message at your message, be not afraid of that.

My message was especially not about the memory, but about the performance
my very dear friend (not sarcastic)).

:-)

Cor
Did everyone else miss what I said. Task manager is a VERY bad tool for
determinng memory allocation within .NET. That's why you have to use the profiler. .NET Memory profiler is an excellent tool to give accurate
results (as well as see what classes are leaking).

And.. if your using any Component One Controls, thats where your leak
probably is..Because C1 Controls are garbage.


Nov 21 '05 #11
In article <u2**************@TK2MSFTNGP09.phx.gbl>, CJ Taylor wrote:
Did everyone else miss what I said. Task manager is a VERY bad tool for
determinng memory allocation within .NET. That's why you have to use the
profiler. .NET Memory profiler is an excellent tool to give accurate
results (as well as see what classes are leaking).

And.. if your using any Component One Controls, thats where your leak
probably is..Because C1 Controls are garbage.

-CJ


No... I almost made reference to your post actually - but, I figured it
stood on it's own. You are definately correct. Using the Task Manager
for this kind of profiling is pretty worthless.

--
Tom Shelton [MVP]
Nov 21 '05 #12
Hmmm apparently (given this is the second message). I came off a little
angry/crass in my last message.

To everyone, I apologize, wasn't meant to be that way...
"Tom Shelton" <to*@YOUKNOWTHEDRILLmtogden.com> wrote in message
news:OC**************@TK2MSFTNGP11.phx.gbl...
In article <u2**************@TK2MSFTNGP09.phx.gbl>, CJ Taylor wrote:
Did everyone else miss what I said. Task manager is a VERY bad tool for
determinng memory allocation within .NET. That's why you have to use the profiler. .NET Memory profiler is an excellent tool to give accurate
results (as well as see what classes are leaking).

And.. if your using any Component One Controls, thats where your leak
probably is..Because C1 Controls are garbage.

-CJ


No... I almost made reference to your post actually - but, I figured it
stood on it's own. You are definately correct. Using the Task Manager
for this kind of profiling is pretty worthless.

--
Tom Shelton [MVP]

Nov 21 '05 #13
Hi CJ,

Is it so hard to be married that you even make apologizes to us.

There is already so few fun last times in this newsgroup.

I am glad you kicked it a little bit up.

(I want all the time show you this message I made. It was a discussion if
something what was in C# should be in the same way in VBNet). Kelly found it
a nice one.

http://tinyurl.com/4e57m

:-)

Cor
Nov 21 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andreas Suurkuusk | last post by:
Hi, I just noticed your post in the "C# memory problem: no end for our problem?" thread. In the post you implied that I do not how the garbage collector works and that I mislead people. Since...
4
by: Amadeus | last post by:
Hello Everybody! I have a problem with MySQL servers running RedHat 9 (smp kernel 2.4.20) on Intel and MySQL server 4.0.14 (problem also appears on binary distr 4.0.15 and on 4.0.15 I bilt myself...
32
by: John | last post by:
Hi all: When I run my code, I find that the memory that the code uses keeps increasing. I have a PC with 2G RAM running Debian linux. The code consumes 1.5G memory by the time it finishes...
17
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is...
16
by: JCauble | last post by:
We have a large Asp.net application that is currently crashing our production servers. What we are seeing is the aspnet_wp eat up a bunch of memory and then stop unexpectedly. Does not recycle. ...
7
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports...
9
by: Bruno Barberi Gnecco | last post by:
I'm using PHP to run a CLI application. It's a script run by cron that parses some HTML files (with DOM XML), and I ended up using PHP to integrate with the rest of the code that already runs the...
9
by: jeungster | last post by:
Hello, I'm trying to track down a memory issue with a C++ application that I'm working on: In a nutshell, the resident memory usage of my program continues to grow as the program runs. It...
17
by: frederic.pica | last post by:
Greets, I've some troubles getting my memory freed by python, how can I force it to release the memory ? I've tried del and gc.collect() with no success. Here is a code sample, parsing an XML...
27
by: George2 | last post by:
Hello everyone, Should I delete memory pointed by pointer a if there is bad_alloc when allocating memory in memory pointed by pointer b? I am not sure whether there will be memory leak if I do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.