garbage-collection

Java and .NET heap overhead

I have understanding how heap and garbage collector works: garbage collection happens in generations, memory allocation happens sequentially, during garbage collection free/unused space compacted by shifting data and forming continues block, etc. Is there any headers for allocated memory chunks are present and how big are they (I heard...

Will Garbage Collected C be Faster Than C++?

I had been wondering for quite some time on how to manager memory in my next project. Which is writing a DSL in C/C++. It can be done in any of the three ways. Reference counted C or C++. Garbage collected C. In C++, copying class and structures from stack to stack and managing strings separately with some kind of GC. The community ...

What is the scale of PHP's circular reference problem and should I worry about it?

If I am using a tree structure of nodes similar to the code below, do I have to worry about the circular reference? I have read that PHP uses a memory allocation mechanism which can make life very hard for the garbage collector when there are circular references involved. What I want to know is: If my tree consists of only a few n...

.NET Garbage Collector - Terminal Services

Is there one Garbage Collector for an entire system one instance of a garbage collector for each user that is logged in one garbage collector for each running .NET application Or is it none of the above (please explain)? ...

Proper use of the IDisposable interface

I know from reading the MSDN documentation that the "primary" use of the IDisposable interface is to clean up unmanaged resources http://msdn.microsoft.com/en-us/library/system.idisposable.aspx. To me, "unmanaged" means things like database connections, sockets, window handles, etc. But, I've seen code where the Dispose method is imple...

A 90/10 Rule for Memory Management?

Most programmers agree that garbage collection is a great thing, and in most applications is well worth the overhead. However, my personal observation is that memory management for most objects is trivial, and maybe 10%-20% of them account for the need for kludges such as reference counting and really complicated memory management schem...

Know of any Java garbage collection log analysis tools?

I'm looking for a tool or a script that will take the console log from my web app, parse out the garbage collection information and display it in a meaningful way. I'm starting up on a Sun Java 1.4.2 JVM with the following flags: -verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails The log output looks like this: 54.736: [Full GC ...

Hardware Assisted Garbage Collection

I was thinking on ways that functional languages could be more tied directly to their hardware and was wondering about any hardware implementations of garbage collection. This would speed things up significantly as the hardware itself would implicitly handle all collection, rather than the runtime of some environment. Is this what LISP...

How do you get rid of an object in c#

In the following c# code, how do I get rid of the objects when it's no longer useful? Does it get taken care of automatically, or do I need to do something? public void Test() { object MyObject = new object(); ... code ... } ...

Will calling close() on my WCF service release all resources?

Will calling close on my WCF service kill all resources or set them up for GC or should I set it to null also? ...

Is Objective-C 2.0 exception handling supported on non Mac OS X platforms?

Objective-C 2.0 has some new enhancements: garbage collection fast enumeration: for..in properties thread synchronization: @synchronized(self) @try/@catch/@finally/@throw exception handling I'm interested in using Objective-C 2.0 as a language to program portable code across multiple operating system platforms - while avoiding framew...

Possible reasons for FileStream.Write() to throw an OutOfMemoryException?

I have 10 threads writing thousands of small buffers (16-30 bytes each) to a huge file in random positions. Some of the threads throw OutOfMemoryException on FileStream.Write() opreation. What is causing the OutOfMemoryException ? What to look for? I'm using the FileStream like this (for every written item - this code runs from 10 dif...

How to debug .net Garbage Collection?

Is it possible to have a look at all .net objects which are collected upon calling GC.Collect()? I need to see what objects are still in memory and not reclaimed, so I can find where reclaiming the objects should have done manual, but was forgotten by the programmer. I don't want to call GC.Collect because someone somewhere forgot to di...

Flex memory limit - how to configure

Can I control the memory limit (i.e. when GC has to run) in my Flex application? ...

Keep a large number of objects in memory for a long time

In my ASP.NET app, I have a dictionary that contains a large number of objects (let's say as large as 1M, could get even bigger later), the object stored in the dictionary is of reference type not struct type, the dictionary is meant to work as a cache for this type of objects (I have my reasons not to use the ASP.NET cache for caching t...

Experiencing >1 second pauses using UseConcMarkSweepGC - help!

Hi, I'm running a memory intensive app on a machine with 16Gb of RAM, and an 8-core processor, and Java 1.6 all running on CentOS release 5.2 (Final). Exact JVM details are: java version "1.6.0_10" Java(TM) SE Runtime Environment (build 1.6.0_10-b33) Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode) I'm launching the app...

How does python close files that have been gc'ed?

I had always assumed that a file would leak if it was opened without being closed, but I just verified that if I enter the following lines of code, the file will close: >>> f = open('somefile.txt') >>> del f Just out of sheer curiosity, how does this work? I notice that file doesn't include a __del__ method. ...

Experiencing occasional long garbage collection delays, why?

I'm having a hard time dealing with a Java garbage collection problem, and interpreting the logs. My application requires that no GC takes longer than 2 seconds, and ideally less than 100ms. Based on some previous advice I'm trying the following command line options: java -XX:MaxGCPauseMillis=100 -XX:NewRatio=9 -XX:+UseConcMarkSweepG...

How can I write a unit test to determine whether an object can be garbage collected ?

In relation to my previous question, I need to check whether a component that will be instantiated by Castle Windsor, can be garbage collected after my code has finished using it. I have tried the suggestion in the answers from the previous question, but it does not seem to work as expected, at least for my code. So I would like to write...

Garbage Collection every 100 seconds

Did any one encountered an scenario where application under high memory allocation load performed second generation collection every 100 seconds ? We using 64-bit server with 8-16 GB of physical memory. Application has several GB of data what is stored in cache and can't be cleaned from it becouse it's actualy used by application. In ...