By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,027 Members | 1,236 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,027 IT Pros & Developers. It's quick & easy.

finding memoryleak

P: n/a
LS
I have consoleapplication which is always running fine for serval weeks
until I get an "out of memory exception"
I thougth the dotnet framework was supposed to handle my bad programming :)
What is the best method to find this memoryleak?

Regards

Geert
Nov 21 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Geert,

Can you show a little piece of your code.

(How do you instance by example objects and values)

Cor
Nov 21 '05 #2

P: n/a
LS
> Can you show a little piece of your code.

euh, the program is rather long:
I think I do it the way it should be.

I always do

dim blabla as someobject

And at the end

blabla.dispose
Nov 21 '05 #3

P: n/a
Where do you do this,
dim blabla as someobject


Because not everybody does that the same

Cor
Nov 21 '05 #4

P: n/a
LS
> Where do you do this,
dim blabla as someobject


Because not everybody does that the same

At the beginning of the function/method.
Can you give me an example of how to do it good and bad.
Anyhow isn't dotnet supposed to do garbagecollection?
Nov 21 '05 #5

P: n/a
LS,

In my opinion is this very bad
private a as arraylist
private b as new object
Sub C
a = new arraylist
a.add(b)
End sub

I did not test it if there is some extra intelligence, however I assume that
all those new created arraylist stay until the end of the program because
they have all a reference to b.

Sub D
dim a as new arraylist
dim b as new object
a.add(b)
End sub

Here you are sure that all goes out of scope and by the objects used memory
will be released by the GC. However this last one is not always possible of
course.

Cor


Nov 21 '05 #6

P: n/a
"LS" <in*****@invalid.com> schrieb:
I have consoleapplication which is always running fine for serval weeks
until I get an "out of memory exception"
I thougth the dotnet framework was supposed to handle my bad programming
:)
What is the best method to find this memoryleak?


Allocation Profiler src
<URL:http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=3254325d-a4aa-4bb3-aa86-c72d5104ec74>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #7

P: n/a
If you're willing to pay $100, or if you can find the solution within the
14day trial period you can download this tool:

http://www.scitech.se/memprofiler/download.aspx

I find it very usefull

hth

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.
Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.