garbage-collection

Can I test if another reference exists to an object in java?

Is it possible to test for the existence of other references to an object in java? Even if the operation is inefficient, I would like to assert while debugging that a given object will be garbage collected once a given reference falls out of scope. Is this possible? Thanks ...

Garbage collection of pagecontext attributes java

Consider, pageContext.setAttribute("name", new String("Shal")); String name1= new String("Jason"); pageContext.setAttribute("Alternate Name", name1)); how the memory is allocated for the above two attributes,how and when that memory allocated will be recovered. What is the best practice to follow ...

Rolling garbage collector logs in java

Is it possible to do a rolling of garbage collector logs in Sun JVM? Currently I generate logs using: -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -verbose:gc -Xloggc:gc.log But I have to manually rotate them using fifo queues and rotatelogs to create a new log for each day. I hope that there is a better solutio...

When is garbage collector used in java?

As far as I know GC is used only when JVM needs more memory, but I'm not sure about it. So, please, someone suggest an answer to this question. ...

Flash Player: Get reference count for variable

I'm looking to build a library that needs to be very careful about memory management. Basically, I have to create a static factory to "disperse" instances of my tool to requesting objects. (I don't have a choice in this matter, I really do have to use a singleton) We'll call that class FooFactory. FooFactory defines a single method, getF...

Under what circumstances, we need to call GC.Collect twice.

We have a WPF application, based on Unity with MMVVVM pattern. In application life cycle there can be several project life cycles, after each project life cycle we do a manual Tear Down and try to free all the reference of ViewModels. For event subscriptions with Unity we are using Weak references. So we are assuming that after tear down...

Java GC: PSYoungGen grows by 4 GB after Full GC

I'm running an application server which uses quite a bit of memory (there are quite a few users). It's running on an 18 GB EC2 instance. I pass these GC parameters to the VM: -server -XX:GCTimeRatio=19 -Xmx12g -XX:+PrintGCDetails -XX:+PrintGCTimeStamps The server works fine for awhile (as well as you'd expecte without concurrent GC) ...

GC seems to cause unresponsiveness in java server app

Hi We have made a webapp running in JBoss 4.2.3 on RedHat Linux 5.2 on a 12 core IBM machine. Lately we have seen long response times, which seems to be caused be GC activities. The pattern is more or less as follows: All requests seem to come at normal rate, but no bytes are sent until suddenly all responses are "flushed". At same time...

How should i deduce when the GC should run?

I am writing a statically compiled language and i would like to support garbage collection. before designing it i would like to know how i should i deduce when the GC should run? Should it be after every 16mb allocate interval? (checking after enough rises or just before it allocates 16+mb). Is there a case to check ealier so loops can ...

how the live objects are figured out in young generation collection ?

I understand that time taken by YGC is proportional to number of live objects in Eden. I also understand that how the live objects are figured out in Major collections (All the objects in thread stacks and static objects and further objects reachable from those objects transitively.) But I dont understand how the live objects are figu...

what are the effects of paging on garbage collection ?

what are the effects of paging on garbage collection ? ...

Using Sos (dumpheap etc) from test code?

Hi, I've recently tracked down a memory leak in my application and I'd like to add a test case to check that it stays that way. What I want to do is this: int numberOfInstancesBeforeFunction = GetNumberOfInstancesInMemory(typeof(MyClass)); PerformFunction(); GC.Collect(); int numberOfInstancesAfterFunction = GetNumberOfInstances...

Ruby Garbage Collection Heap Slot size

So, ruby enterprise documentation states that all the values in the GC settings are defined in slots: http://www.rubyenterpriseedition.com/documentation.html#_garbage_collector_performance_tuning (e.g. RUBY_HEAP_MIN_SLOTS) We fine-tuned our app's min slot size and increment for the best performance by trial and error (we have enough ma...

When to rely on garbage collection and when not?

If I'm going to do this kinda operation many times: res = mysql_perform_query(conn, "show tables"); printf("MySQL Tables in mysql database:\n"); while ((row = mysql_fetch_row(res)) !=NULL) printf("%s\n", row[0]); Do I need to run mysql_free_result(res); at the end of each operation or rely on garbage collection mechanism ...

When to use __gc for classes and structs?

I am updating some old c++ code and am finding that many of the classes are defined as: public __gc class NameOfClass{ } I found a little bit of information about __gc here, but it seems to only come up with information for VS 2003. The MSDN documentation that came with my copy of VS 2005 indicates that __gc may not be in use anymor...

Should I put KeepAlive inside my finally block?

So this tells me that I should put a GC.KeepAlive at the end of my code to keep my mutex open (to prevent multiple instances of my app happening due to early GC disposal of my mutex). But should I put the KeepAlive in my finally block or at the end of my try block? ...

Memory usage during update label with System.Windows.Forms.Timer control

I have a form with label that is updating by System.Windows.Forms.Timer control every 2 seconds. In task manager i see that memory usage is growing even if program is doing nothing(but label is still updating with latest info, that is memory usage for example) Example code for label text: tlblRam.Text = string.Format("Ram: {0} MB", Conv...

Java ConcurrentMarkSweep garbage collector not removing all garbage

Short form: The CMS garbage collector appears to be failing to collect an ever-increasing amount of garbage; eventually, our JVM fills up, and the application becomes unresponsive. Forcing a GC via an external tool (JConsole or jmap -histo:live) cleans it up once. UPDATE: The problem appears to be related to the JTop plugin for JConsol...

Dispose of AddIns created using MAF (System.AddIn)

Hi all, Does anyone know how to dispose of AddIns created using System.AddIn. All the examples online seem to show how to easily load and use an addin, but none show how to dispose of them once they're alive. My Problem is I create addins in new processes, and these processes never get garbage collected, obviously a problem. Below is ...

Memory management bottleneck to SMP Parallelism

Across multiple languages (mostly D and Java/Jython) I've noticed that parallel programs with no obvious synchronization bottleneck often don't scale well to 4 or more cores because of memory management bottlenecks. I'm aware that thread-local allocators mitigate this problem, but most garbage collector implementations still need to sto...