garbage-collection

Implement IDisposable on partial LINQ to SQL entity classes

I am extending LINQ to SQL entity classes using partial classes, and I'm wondering how to best reset some properties on the entity objects to their default state. My partial classes uses no unmanaged recourses. And as far as I can tell; neither does the LINQ to SQL entity classes. So I'm thinking that I'll implement IDisposable and hand...

JVM garbage collection and a paging memory architecture

In the recent 10 year when discussing java and/or garbage collection, the only performance penalty that I have not been able to defend is that garbage collection algorithms more or less breaks when running in a paged memory architecture, and parts of the heap is getting paged out. Unix systems (and especially Linux) agressively pages ou...

Unclear behaviour of a fixed pointer outside of the fixed statement

Can someone explain me why the below C# code doesn't crash? Why does Visual Studio actually allow to compile it? My understanding is that I am getting a fixed pointer, but it is fixed only within the 'fixed' statement. When the pointer is returned from the 'Foo' function, the array 'ar' may be collected. I then force GC to actually do th...

Will the .NET GC mess with an abandoned object executing a method asynchronously?

In .Net, suppose I instantiate an object that starts an asynchronous process (using Delegate.BeginInvoke on one of its methods), then abandon the object by setting the reference to it to null or allowing it to go out of scope. Will the Garbage Collector attempt to collect the object while the asynchronous process is in progress? If not, ...

What is JavaScript garbage collection?

What is JavaScript garbage collection? What's important for a web programmer to understand about JavaScript garbage collection, in order to write better code? ...

Why no Reference Counting + Garbage Collection in C#?

I come from a C++ background and I've been working with C# for about a year. Like many others I'm flummoxed as to why deterministic resource management is not built-in to the language. Instead of deterministic destructors we have the dispose pattern. People start to wonder whether spreading the IDisposable cancer through their code is ...

why are user controls not collected by Gargabe Collector?

I have a large .NET C# application with a memory leak. Using ants memory profiler, I can see that there are multiple versions of same user controls in memory and the garbage collector is not collecting them. There is output caching on the web forms but no output caching on the actual user controls. Is there a reason why the user contro...

Static methods

Possible Duplicates: Garbage collection of static members Will Garbage collector cleans up static methods and static class ...

Is there a way I can know who holds a reference to an object?

Is there a way I can know who holds a reference to an object? I see that my object is not finalized by the d'tor after I call GC.Collect. ...

Garbage Collection does not reduce current memory usage - in release mode. Why?

I built a quick program that needed to loop through an enormous log file (a couple of million records) and find various bits and pieces from inside. Because the volume of data was so huge, I have been curious to watch my Windows Task Manager performance tab and see how much CPU and memory is being used. After the program successfully ge...

Do a self handled event prevent the instance from being garbage-Collected ?

Hi, i read the answer of the question Do event handlers stop garbage collection from occuring?, but what happens when the publisher is the target ? To be more specific, i am using MVVM design for a WPF app. Model-View classes raise a NotifyPropertyChanged on every change. In some classes, i need to call a method when something is modif...

What happened internally (JVM) when System.gc() or finalize() method called?

What happened internally (JVM) when System.gc() or finalize() method called? Is this really collect garbage or reduce performance ? ...

Exceptions and memory

When an exception is thrown or encountered: void ThrowException() { try { throw new Exception("Error"); } catch { } } is it & how is it disposed from memory? and how does the above code differ from the below code in respect of the disposal from memory of the Exception object? void ThrowException() { ...

Java Garbage Collection Log messages

I have configured java to dump garbage collection information into the logs (verbose GC). I am unsure of what the garbage collection entries in the logs mean. A sample of these entries are posted below. I've searched around on Google and have not found solid explanations. I have some reasonable guesses, but I'm looking for answers whic...

How to supress the creation of an (.net) Exception object?

Hi there, If I do not care about a thrown Exception. Can I code in a way as not to create it? In other words, can an Exception be thrown but no Exception object be created? An example - Simple example using a System.Net.Sockets.Socket Socket acceptingSocket; acceptingSocket.Blocking = false; while(condition) { try { ...

Calling System.gc() in mobile

I have to maintain a j2me application. There is a lot of System.gc() inside the application. Before calling System.gc() all the attributes are setted to null. Does setting attributes to null make sense? Does calling System.gc() make sense? Shouldn't the jvm call the garbage collector when is necessary? ...

healthy garbage collection metrics?

i profiled a jdbc/hibernate batch-importer. it takes a csv transforms it slighly and imports it to the database sitting at localhost. to my surprise the operation was not I/O bound but rather cpu-bound. according to jmx/jconsole as well as the netbeans profiler it looked like 60% of the cpu time was spent in the "old gen" garbage colle...

Python MemoryError - how can I force object deletion

I have a program that process several files, and for each file a report is generated. The report generating part is a separate function that takes a filename, then returns. During report generation, intermediate parts are cached in memory, as they may be used for several parts of the report, to avoid recalculating. When I run this progr...

What happens during the garbage collection when 2nd generation is full

Hi guys. I'm rereading CLR via C# right now and have some thoughts about garbage collection routine. In book, after zero generation is filled, garbage collection starts and moves all "not garbage" references to the first generation. The same happens when the first generation is filled. But what happens when second generation is filled? T...

In python, how can you unload generated classes

I am working on a library that loads files (hfd5 - pytables) into an object structure. The actual classes being used for the structure is loaded as a string from the hdf5 file, and then loaded in this fashion: class NamespaceHolder(dict): # stmt is the source code holding all the class defs def execute(self, stmt): exec ...