garbage-collection

Finalizer launched while its object was still being used

Summary: C#/.NET is supposed to be garbage collected. C# has a destructor, used to clean resources. What happen when an object A is garbage collected the same line I try to clone one of its variable members? Apparently, on multiprocessors, sometimes, the garbage collector wins... The problem Today, on a training session on C#, the teac...

What are your strategies to keep the memory usage low?

Ruby is truly memory-hungry - but also worth every single bit. What do you do to keep the memory usage low? Do you avoid big strings and use smaller arrays/hashes instead or is it no problem to concern about for you and let the garbage collector do the job? Edit: I found a nice article about this topic here and another one here - old ...

Is Lambda Probe dead?

Does anyone know where to get the source code for LambdaProbe? Alternatively, does anyone know if the project could be moved to a community repository? Besides the tool not being updated for over a year, the LambdaProbe website has been down since late September 2008. Background: Lambda Probe is a useful tool for viewing stats on a ...

Why doesn't C++ have a garbage collector?

I'm not asking this question because of the merits of garbage collection first of all. My main reason for asking this is that I do know that Bjarne Stroustrup has said that C++ will have a garbage collector at some point in time. With that said, why hasn't it been added? There are already some garbage collectors for C++. Is this just...

Best way to track down a memory leak (C#) only visible on one customer's box

What is the best way to track down a memory leak that is only found on one customer's test/release box, and no where else? ...

PHP __destruct() method

In PHP5, is the __destruct() method guaranteed to be called for each object instance? Can exceptions in the program prevent this from happening? ...

Fixed Statement in C#

We have similar code to the following in one of our projects. Can anyone explain (in simple English) why the fixed statement is needed here? class TestClass { int iMyVariable; static void Main() { TestClass oTestClass = new TestClass(); unsafe { fixed(int* p = &oTestClasst.iMyVari...

How do I make sure my objects get garbage collected?

One of our programs is sometimes getting a OutOfMemory error on one users machine, but of course not when I'm testing it. I just ran it with jprofiler (on a 10 day evaluation license because I've never used it before), and filtering on our code prefix, the biggest chunk both in total size and number of instances is 8000+ instances of a ...

Notification of object destruction in Ruby

I have written a custom Rails model. This model is backed by an actually server not by a database table (so it does not inherit from ActiveRecord::Base). In order to get the requested information from the server I open a SSH connection to it. Because rails does not reuse object a new object, as well as a new SSH connection to the serv...

Implementing cache correctly in a class library for use in an asp.net application

I'm implementing a cache in a class library that i'm using in an asp.net application. I created my cache object as a singleton pattern with a static method to update the cache which is really just loading a member variable/property with a collection of data i need cached (got some locking logic ofcourse). I figured it was a nice way to...

Set server or workstation GC

How can I configure an application, or even an entire machine, to use either the server or workstation flavor of the CLR's garbage collection? ...

How to improve garbage collection performance?

What kind of optimization patterns can be used to improve the performance of the garbage collector? My reason for asking is that I do a lot of embedded software using the Compact Framework. On slow devices the garbage collection can become a problem, and I would like to reduce the times the garbage collector kicks in, and when it does,...

Loops and Garbage Collection

I am working on a web application and I have run into the following situation. Dim a as Object Dim i as Integer = 0 Try For i=1 to 5 a = new Object() 'Do stuff ' a = Nothing Next Catch Finally a = Nothing End Try Do i need to do the a=Nothing in the loop or will the garbage collector clean ...

Why does the memory usage of a .NET application seem to drop when it is minimized?

For example, launch Paint.NET. Then have a look on its memory usage with Task Manager: on my computer, it uses 36Mb. Then minimize Paint.NET: now it takes only a few more than 1Mb. This happens with every .NET Application. What happens when a .NET Application is minimized? Is a GC occurring? ...

Circular References in Java

Given an aggregation of class instances which refer to each other in a complex, circular, fashion: is it possible that the garbage collector may not be able to free these objects? I vaguely recall this being an issue in the JVM in the past, but I thought this was resolved years ago. yet, some investigation in jhat has revealed a circul...

How do you manage deterministic finalization in C#?

I have a C# object with a critical resource that needs to be flushed very specific points in time making it a bad candidate to leave around for the garbage collector to take care of whenever it gets around to it, how should I handle this? Is there something like C++'s delete operator that will let me manually kill the instance of this ...

Force Garbage Collection in AS3?

Is it possible to programmatically force a full garbage collection run in ActionScript 3.0? Let's say I've created a bunch of Display objects with eventListeners and some of the DO's have been removed, some of the eventListeners have been triggered and removed etc... Is there a way to force garbage collection to run and collect everythi...

How do I discover what is in the permanent generation

Given a heapdump or a running VM, how do I discover what the contents of the permanent generation is ? I know about 'jmap -permstat' but that's not available on Windows. ...

Memory leak in .NETCF - creating dynamic controls?

I have a problem with a memory leak in a .NET CF application. Using RPM I identified that dynamically creating controls are not garbage collected as expected. Running the same piece of code in .NET Window Forms behave differently and disposes the control as I expected. See the output from RPM via PerfMon for the Process Heap counter...

Cocoa Distributed Objects, GC client, non-GC server

I have a setup where there are two Cocoa processes, communicating with Distributed Objects (DO). The client is using garbage collection, the server is not. It seems that the client hangs on to the distant objects outside of my direct references to them. This means that even after I don't have references to the objects, they hang around ...