newbie: ArrayList memory leak?

P

Peter Schmitz

Hi everyone,

I am new to .net programming and I do have some serious memory problems:

In my current application I need to maintain a big linked list (of Type
ArrayList), which includes items/class instances that contain filled members
of ArrayList themselves,e.g.

Public Class MyTestClass
Public myList as ArrayList 'filled with data
End Class

Dim mytest as new ArrayList 'contains lots of MyTestClasses

Now, when the main thread of my application is finished, I call
mytest.Clear() to free the memory I used. Unfortunately, the RAM consumption
of my application does not change through this call. Do I have to call Clear
on every 'index' in my ArrayList? Is there a way to explicitly delete a
variable in VB .net (just as malloc() and free() in good old C++)?

Best wishes,

Peter
 
A

Armin Zingler

Peter said:
Hi everyone,

I am new to .net programming and I do have some serious memory
problems:

In my current application I need to maintain a big linked list (of
Type ArrayList), which includes items/class instances that contain
filled members of ArrayList themselves,e.g.

Public Class MyTestClass
Public myList as ArrayList 'filled with data
End Class

Dim mytest as new ArrayList 'contains lots of MyTestClasses

Now, when the main thread of my application is finished, I call
mytest.Clear() to free the memory I used. Unfortunately, the RAM
consumption of my application does not change through this call. Do I
have to call Clear on every 'index' in my ArrayList? Is there a way
to explicitly delete a variable in VB .net (just as malloc() and
free() in good old C++)?

Best wishes,


The Framework uses a garbage collection mechanism. It destroys objects....
read here:
http://msdn.microsoft.com/en-us/library/f144e03t.aspx


Armin
 
C

Cor Ligthert[MVP]

Peter,

You tell the memory consumption is to high, do you see that because your
computer is acting to slow after a while or does it restart?

Cor
 
M

Michel Posseth [MCP]

I just wonder if ..............


Please befor this thread goes wild please try the following , after you have
done everything you said
minimize the app wait a few seconds and then maximize the app watch the
memory behavior now
is it fine now ? , well then my friend it is time for you to learns some
more about the memory management of the .Net framework

regards

Michel
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top