garbage-collection

Java closure types, variables, arrays and collections

What is the current state of spec for Java closure? 1. In the proposed Java closure spec, would we be able to create an array or collection of closures? If so, would this syntax be possible? {int x, int y => boolean b}[] comparisonSwitch = { {int i, int j => return i>j}, {int i, int j => return j<i}, {int i, int j => return j==...

Does boxing create garbage in .NET?

Hi! I'm wondering whether boxing a value type in an object is a special case or whether the "box" constructed by .NET becomes garbage (that the GC has to collect) after any references to it are dropped. For example, StringBuilder.AppendFormat() has these overloads: StringBuilder.AppendFormat(string format, object arg0); StringBuilder....

When to use objc_memmove_collectable directly in Objective-C code?

While looking for something else in header files and documentation, I recently discovered the following function prototype in <objc/objc-auto.h>: void *objc_memmove_collectable(void *dst, const void *src, size_t size); It's in the middle of a group of functions following a comment that says "Write barriers. Used by the compiler". The...

Memory Leak in large Array - Will subclassing IList fix it?

I need to improve memory performance on my application and I could see that I have problems with memory fragmentation. I've read an interesting article on large objects from Andrew Hunter of Red Gate, and one of the solutions he recommends is: If large data structures need to live for a long time, and especially if they need to ...

Java G1 garbage collection in production

Since Java 7 is going to use the new G1 garbage collection by default is Java going to be able to handle an order of magnitude larger heap without supposed "devastating" GC pause times? Has anybody actually implemented G1 in production, what were your experiences? To be fair the only time I have seen really long GC pauses is on very la...

Impact of 'instanceof' in Android Java code

Does the 'instanceof' keyword bear with it a relatively heavier impact on the Android platform (and more speciffically the mobile phones running the Dalvik VM)? Thank you. ...

Error System.ObjectDisposedException VSTO SmartTag?

I'm having trouble getting a vsto project to work. It's a simple Word 2007 addin application that adds a smarttag identifier. here's the error: ************** Exception Text ************** System.ObjectDisposedException: Cannot access a disposed object. at Microsoft.Office.Tools.SmartTagCollection.BeginInit() at WordInWord.ThisA...

Does Java have automatic garbage collection?

Does it happen automatically? How do can run it? ...

Ruby Class object garbage collection

Hi, In ruby all classes are objects of class Class. Since classes are also objects, does a Ruby VM follow the same Garbage Collection strategy for class objects? What determines that a class object is safe for garbage collection? Thanks ...

Garbage-collectors for multi-core llvm?

Dear overflowers, I've been looking at LLVM for quite some time as a new back-end for the language I'm currently implementing. It seems to have good performance, rather high-level generation APIs, enough low-level support to optimize exotic optimizations. In addition, and although I haven't checked it myself, Apple seems to have success...

What is a good gc tuning strategy for gc output that I have?

This is the output after running for around 10 minutes. Heap PSYoungGen total 7040K, used 0K [0x24060000, 0x247c0000, 0x26790000) eden space 6528K, 0% used [0x24060000,0x24060000,0x246c0000) from space 512K, 0% used [0x246c0000,0x246c0000,0x24740000) to space 512K, 0% used [0x24740000,0x24740000,0x247c0000) ParOldGen ...

Android GC - LogCat always showing GC activity

when i run my program, logcat shows a lot of activity with GC like GC freed 10324 objects/ 510376 bytes in 103 ms GC freed 10324 objects/ 510376 bytes in 103 ms GC freed 10324 objects/ 510376 bytes in 103 ms GC freed 10324 objects/ 510376 bytes in 103 ms GC freed 10324 objects/ 510376 bytes in 103 ms with diff in obj, bytes and ms va...

Calming an excited Garbage Collector

I've got a program that runs very happily with -Xmx2g. With -Xmx1g, it grinds to a halt. It never gets an out of memory exception -- or, at least, I've never had the patience to wait long enough. This suggests that the total footprint does fit into 1g, but that the GC has some anxiety about possibly running out of space. The memory foo...

How Phantom reference works ?

The API doc says This reference type differs from the others in that it isn't meant to be used to access the object, but as a signal that the object has already been finalized, and the garbage collector is ready to reclaim its memory. If Phantom reference cannot be used to access the object, how does the garbage collector reclaims...

How to dispose managed resource in Dispose() method in C#?

Hi, I know Dispose() is intended for unmanaged resource, and the resource should be disposed when it is no longer needed without waiting for the garbage collector to finalize the object. However, when disposing the object, it suppress finalization of the garbage collector (GC.SuppressFinalize(this); in the code below). This means t...

Why does the specified object be eligible for garbage collection?

For the record, I'm NOT a Java Beginner, but -- rather - an intermediate-level guy who kinda forgot a bit about fundamentals about Java. class C{ public static void main(String a[]){ C c1=new C(); C c2=m1(c1); //line 4 C c3=new C(); c2=c3; // line 6 anothermethod(); } ...

Determine when the Android GC runs

Does anyone know if there is a way to identify (in code, not LogCat) when the GC has run? Perhaps an intent is fired? I could analyze the LogCat output, but it would be ideal if I could determine when the GC has run from my code. ...

garbage collection best practices

Hi If you're removing a MovieClip from the display list, and that MovieClip in turn has child MovieClips which have their own event listeners, is it necessary to remove ALL listeners from the child MovieClips? or just the parent MovieClip that is being directly removed from the display list? ...

Java -verbose:gc Performance Implications?

Just wondering if enabling verbose GC would have any effect on the performance of an application. My guess is no not really. I know that enabling verbose GC can output a fair bit data and was wondering is this realistically going to have any effect on performance? ...

Timer, event and garbage collection : am I missing something ?

Consider the following code : class TestTimerGC : Form { public TestTimerGC() { Button btnGC = new Button(); btnGC.Text = "GC"; btnGC.Click += (sender, e) => GC.Collect(); this.Controls.Add(btnGC); System.Windows.Forms.Timer tmr = new System.Windows.Forms.Timer(); tmr.Interval = 1...