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
...
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
...
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...
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.
...
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...
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...
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) ...
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...
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 ...
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 ?
...
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...
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...
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 ...
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...
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?
...
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...
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...
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 ...
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...