473,813 Members | 2,514 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory doesn't release (from collections)

Hello, I am using several queue collections to store some data (about 20,000
entries split across 2 collections). When I view the process in the Windows
task manager I can see the memory increasing when the collections start to
fill. However, when I stop the thread and clear the queues (and set the
instance to nothing) the memory does not drop at all.

Am I doing something wrong?

Thanks!!
Nov 21 '05 #1
11 1230
Just because an object is eligible for garbage collection, doesn't mean it
gets garbage collected right away.

When the garbage collector decides to run, then anything eligible will get
collected. Until then it will sit there taking up memory.

"Brian Mitchell" <Ma********@hot mail.com> wrote in message
news:us******** ******@TK2MSFTN GP12.phx.gbl...
Hello, I am using several queue collections to store some data (about 20,000 entries split across 2 collections). When I view the process in the Windows task manager I can see the memory increasing when the collections start to
fill. However, when I stop the thread and clear the queues (and set the
instance to nothing) the memory does not drop at all.

Am I doing something wrong?

Thanks!!

Nov 21 '05 #2
is there a way to "force" garbage collection?

"Marina" <so*****@nospam .com> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
Just because an object is eligible for garbage collection, doesn't mean it
gets garbage collected right away.

When the garbage collector decides to run, then anything eligible will get
collected. Until then it will sit there taking up memory.

"Brian Mitchell" <Ma********@hot mail.com> wrote in message
news:us******** ******@TK2MSFTN GP12.phx.gbl...
Hello, I am using several queue collections to store some data (about

20,000
entries split across 2 collections). When I view the process in the

Windows
task manager I can see the memory increasing when the collections start to fill. However, when I stop the thread and clear the queues (and set the
instance to nothing) the memory does not drop at all.

Am I doing something wrong?

Thanks!!


Nov 21 '05 #3
Yes, you can use gc.collect but no matter I let the program sit for 2 hours
and it still didn't free the memory. I even set a breakpoint to make sure
the class was set to nothing.

"Dave" <dave(delete_th is)@miraclecatD ELETETHISTOO.co m> wrote in message
news:u8******** ******@TK2MSFTN GP10.phx.gbl...
is there a way to "force" garbage collection?

"Marina" <so*****@nospam .com> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
Just because an object is eligible for garbage collection, doesn't mean
it
gets garbage collected right away.

When the garbage collector decides to run, then anything eligible will
get
collected. Until then it will sit there taking up memory.

"Brian Mitchell" <Ma********@hot mail.com> wrote in message
news:us******** ******@TK2MSFTN GP12.phx.gbl...
> Hello, I am using several queue collections to store some data (about

20,000
> entries split across 2 collections). When I view the process in the

Windows
> task manager I can see the memory increasing when the collections start to > fill. However, when I stop the thread and clear the queues (and set the
> instance to nothing) the memory does not drop at all.
>
> Am I doing something wrong?
>
> Thanks!!
>
>



Nov 21 '05 #4
is there a way to "force" garbage collection?

"Marina" <so*****@nospam .com> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
Just because an object is eligible for garbage collection, doesn't mean it
gets garbage collected right away.

When the garbage collector decides to run, then anything eligible will get
collected. Until then it will sit there taking up memory.

"Brian Mitchell" <Ma********@hot mail.com> wrote in message
news:us******** ******@TK2MSFTN GP12.phx.gbl...
Hello, I am using several queue collections to store some data (about

20,000
entries split across 2 collections). When I view the process in the

Windows
task manager I can see the memory increasing when the collections start to fill. However, when I stop the thread and clear the queues (and set the
instance to nothing) the memory does not drop at all.

Am I doing something wrong?

Thanks!!


Nov 21 '05 #5
Yes, you can use gc.collect but no matter I let the program sit for 2 hours
and it still didn't free the memory. I even set a breakpoint to make sure
the class was set to nothing.

"Dave" <dave(delete_th is)@miraclecatD ELETETHISTOO.co m> wrote in message
news:u8******** ******@TK2MSFTN GP10.phx.gbl...
is there a way to "force" garbage collection?

"Marina" <so*****@nospam .com> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
Just because an object is eligible for garbage collection, doesn't mean
it
gets garbage collected right away.

When the garbage collector decides to run, then anything eligible will
get
collected. Until then it will sit there taking up memory.

"Brian Mitchell" <Ma********@hot mail.com> wrote in message
news:us******** ******@TK2MSFTN GP12.phx.gbl...
> Hello, I am using several queue collections to store some data (about

20,000
> entries split across 2 collections). When I view the process in the

Windows
> task manager I can see the memory increasing when the collections start to > fill. However, when I stop the thread and clear the queues (and set the
> instance to nothing) the memory does not drop at all.
>
> Am I doing something wrong?
>
> Thanks!!
>
>



Nov 21 '05 #6
I believe one of the criteria for the Garbage Collector to run is the need
for memory space. If you have plenty of memory space, it may be that the
Garbage Collector doesn't think it needs to run. You might try running
another application that take a lot of memory to see if it releases some
memory.

"Brian Mitchell" wrote:
Yes, you can use gc.collect but no matter I let the program sit for 2 hours
and it still didn't free the memory. I even set a breakpoint to make sure
the class was set to nothing.

"Dave" <dave(delete_th is)@miraclecatD ELETETHISTOO.co m> wrote in message
news:u8******** ******@TK2MSFTN GP10.phx.gbl...
is there a way to "force" garbage collection?

"Marina" <so*****@nospam .com> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
Just because an object is eligible for garbage collection, doesn't mean
it
gets garbage collected right away.

When the garbage collector decides to run, then anything eligible will
get
collected. Until then it will sit there taking up memory.

"Brian Mitchell" <Ma********@hot mail.com> wrote in message
news:us******** ******@TK2MSFTN GP12.phx.gbl...
> Hello, I am using several queue collections to store some data (about
20,000
> entries split across 2 collections). When I view the process in the
Windows
> task manager I can see the memory increasing when the collections start

to
> fill. However, when I stop the thread and clear the queues (and set the
> instance to nothing) the memory does not drop at all.
>
> Am I doing something wrong?
>
> Thanks!!
>
>



Nov 21 '05 #7
Dave,

There are two criteria to let a object get removed by the garbage collector.
1 it has itself no reference anymore
2 there is not any reference anymore to it

Private myarraylist1 as new arraylist
sub mysub
dim myarraylist2 as new arraylist
myarraylist.add (myarraylist2)
end sub

Although mysub goes out of scope and myarraylist2 is automaticly nothing,
will it not be removed as long as myarralist1 exist.

I hope this helps?

Cor
Nov 21 '05 #8
I believe one of the criteria for the Garbage Collector to run is the need
for memory space. If you have plenty of memory space, it may be that the
Garbage Collector doesn't think it needs to run. You might try running
another application that take a lot of memory to see if it releases some
memory.

"Brian Mitchell" wrote:
Yes, you can use gc.collect but no matter I let the program sit for 2 hours
and it still didn't free the memory. I even set a breakpoint to make sure
the class was set to nothing.

"Dave" <dave(delete_th is)@miraclecatD ELETETHISTOO.co m> wrote in message
news:u8******** ******@TK2MSFTN GP10.phx.gbl...
is there a way to "force" garbage collection?

"Marina" <so*****@nospam .com> wrote in message
news:uC******** ******@TK2MSFTN GP09.phx.gbl...
Just because an object is eligible for garbage collection, doesn't mean
it
gets garbage collected right away.

When the garbage collector decides to run, then anything eligible will
get
collected. Until then it will sit there taking up memory.

"Brian Mitchell" <Ma********@hot mail.com> wrote in message
news:us******** ******@TK2MSFTN GP12.phx.gbl...
> Hello, I am using several queue collections to store some data (about
20,000
> entries split across 2 collections). When I view the process in the
Windows
> task manager I can see the memory increasing when the collections start

to
> fill. However, when I stop the thread and clear the queues (and set the
> instance to nothing) the memory does not drop at all.
>
> Am I doing something wrong?
>
> Thanks!!
>
>



Nov 21 '05 #9
> Dave,
Sorry should have been Brian,
Nov 21 '05 #10

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

Similar topics

4
2595
by: Franklin Lee | last post by:
Hi All, I use new to allocate some memory,even I doesn't use delete to release them. When my Application exit, OS will release them. Am I right? If I'm right, how about Thread especally on Solaries OS? This means that I use new to allocate memory in one Thread and doesn't use delete to release them.
9
2357
by: Mike P | last post by:
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.
7
6545
by: Lars-Erik Aabech | last post by:
Hi! I've got problems with serializing my collections of business objects. The objects themselves serialize fine, but the collections fail. I've got the following structure: Base collection class: Derives MarshalByValueComponent Implements ICollection, IList and ISerializable Explicitly implements the IList methods as private members, (ie. int
25
2394
by: Zeng | last post by:
I finally narrowed down my code to this situation, quite a few (not all) of my CMyClass objects got hold up after each run of this function via the simple webpage that shows NumberEd editbox. My memory profile shows that those instances survive 3 rounds of GC collections - it's not what I expected. In my real code, CMyClass occupies big amount of memory and they all share one stance of another class that I don't have enough memory hold...
30
4707
by: MAG1301 | last post by:
I've detected memory leaks in our huge .NET 1.1 C# application but couldn't localize them directly. So I've reduced the code to the following console application: using System; using System.IO; namespace MemLeak { class MemLeak
7
1700
by: Malcolm Klotz | last post by:
Hello, I have created a Windows Service application in VB.Net 2005. The service is pretty basic, it uses the System.Timers.Timer class to poll a database that checks for jobs to perform. Upon finding a job, the System.Timers.ElapsedEventHandler creates a new thread to execute the job. The job is pretty basic, it uses and xml document and applies it to an XSLT document using the XSLTransform class.
8
2056
by: Lauren the Ravishing | last post by:
Hi, In ASP, is it absolutely necessary to set an object to Nothing after being used? set myObj = server.createObject("myDLL.myClass") call myObj.useClass set myObj = Nothing <--- can I omit this? I'm dealing with a large number of files with nested includes. There
0
1274
by: xievvv | last post by:
We are experiencing a memory leak in one of our applications. It is a web-based reporting system that produces large (> 500mb) PDF reports. It takes approx 4 hours to run the largest of these reports and during this process we have been experiencing issues with the aspnet worker process being recycled as the application's memory keeps growing to around 600mb. From my investigation, it appears that the memory is becoming bloated with character...
15
2219
by: Frank Rizzo | last post by:
I have an app ( referenced in thread news://msnews.microsoft.com:119/OPTBaFDlHHA.3280@TK2MSFTNGP05.phx.gbl ) that won't give up memory. Several people stated that GC won't clean up memory unless pressured to do so (e.g. system running out of memory). So I wrote a quickie app to gobble up memory 100mb at a time, but I still don't see anything giving up memory (including other .NET apps). I see the commit charge going up and go past the...
0
10669
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10424
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10140
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5706
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3885
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3030
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.