Recently I came across a gcc extension that I have found rather useful: __attribute__(cleanup)
Basically, this allows you to assign a cleanup call to a local variable at the time it exits scope. For instance, given the following section of code, all memory must be maintained and handled explicitly in any and all cases within the call to...
If I have an object stored in memory, and I walk away from my application for an hour, will the object still be there when I get back?
In other words, will the .NET garbage collector throw my object away because it hasn't been used for awhile?
...
We found that, since today, the "% Time in GC" (percent time in Garbage Collector) performance timer, steadily stood on 100% with only occasionally a bit lower. Even when at night no visitors were online.
Then I placed App_Offline.htm in the root. Usually this brings down all ASP.NET activity. But for some odd reason, the "% Time in GC"...
I turned on verbose GC options on my JDK, and now I'm seeing lines such as
25.598: [CMS-concurrent-sweep-start]
25.622: [CMS-concurrent-sweep: 0.023/0.024 secs] [Times: user=0.02 sys=0.00, real=0.03 secs]
25.623: [CMS-concurrent-reset-start]
25.629: [CMS-concurrent-reset: 0.007/0.007 secs] [Times: user=0.01 sys=0.00, real=0.00 secs]
...
I'm getting "abort preclean due to time" when running Concurrent Mark & Sweep in Java 6.
What does it mean? Is the GC really halting in the middle before it did any real work?
...
I turned on Java's GC log options
-XX:+PrintGC -XX:+PrintGCTimeStamps -XX:+PrintGCDetails
Which print out these messages to standard output (catalina.out):
314.884: [CMS-concurrent-mark-start]
315.014: [CMS-concurrent-mark: 0.129/0.129 secs] [Times: user=0.14 sys=0.00, real=0.13 secs]
315.014: [CMS-concurrent-preclean-start]
315.0...
I'm trying to analyze GC behaviour for our application (running in Tomcat, under Sun's Hotspots, JVM 1.6).
So far I've:
Instructed the JVM to emit GC logs to a separate file using:
-Xloggc:gc.log -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime
-XX:+PrintGC -XX:+PrintGCTimeStamps -XX:+PrintGCDetails
...
We've recently migrated our systems from Sun Java 5 to Java6 server VM (specifically, 1.6.0_16 on Linux 32 bit). We've noticed that the garbage collection behaviour has changed in such a way as to trigger our heap-warning monitoring system.
The heap usage graphs indicate a much "spikier" memory usage profile than we saw with Java5, wit...
Hi,
I have a code that does compression, encryption and checksum on a File Outputstream. Following is the code-
private void start() {
OutputStream os = null;
try {
os = new FileOutputStream("/some/file");
os = wrapAllRequiredTransforms(os);
//Write to os
} finally {
os.close();
}
}
private wrap...
In an objective C project with GC enabled, I am allocating an array of variable size on the stack like this:
MaValue *myStack = alloca((sizeof(id) * someLength));
(The reason why I want to do this is not important:)
Then, within a loop, I push and pop stuff on/from myStack. Some of the things I push onto the stack are new objects that...
Do you always assign null to an object after its scope has been reached?
Or do you rely on the JVM for garbage collection?
Do you do it for all sort of applications regardless of their length?
If so, is it always a good practice?
...
In holy wars about whether garbage collection is a good thing, people often point out that it doesn't handle things like freeing file handles. Putting this logic in a finalizer is considered a bad thing because the resource then gets freed non-deterministically. However, it seems like an easy solution would be for the OS to just make s...
Lets say you want to write a high performance method which processes a large data set.
Why shouldn't developers have the ability to turn on manual memory management instead of being forced to move to C or C++?
void Process()
{
unmanaged
{
Byte[] buffer;
while (true)
{
buffer = new Byte[10240...
It’s fairly well documented that when .NET's automatic garbage collector runs, it will temporarily pause all running managed threads associated with the application domain. What I haven't been able to discover are details on what happens to native threads created by the application when garbage collection occurs (ie. using _beginthreadex...
Examining a Java runtime with CMS (Concurrent-Mark-Sweep) GC enabled, what is the definition of the CMS space in the logs below? Shall I assume it is the tenured space? I see the following lines of a minor-major-minor GC event
23.481: [GC 23.481: [DefNew: 1051K->128K(1152K), 0.0029912 secs] 11925K->11027K(13600K), 0.0031697 secs] [Tim...
Java garbage collector runs with priority 1, due to which it is not guaranteed that System.gc() will actually execute if called.
Is there any way to change its priority? This shall enable me to run if I want.
...
I'm still investigating issues I have with GC tuning (see prior question), which involves lots of reading and experimentation.
Sun Java5+ JVMs attempt to automatically select the optimal GC strategy and parameters based on their environment, which is great, but I can't figure out how to query the running JVM to find out what those param...
Here's some sample code:
using System;
namespace UnloadFromFinalizer
{
class Program
{
static void Main(string[] args)
{
Program p = new Program();
}
AppDomain domain;
Program()
{
this.domain = AppDomain.CreateDomain("MyDomain");
}
~Program...
i want to know the internal architecture and function of the garbage collector in dotnet in detail.. can anybody help me.
...
From my understanding, garbage collection in java cleans up some object iff nothing else is 'pointing' to that object. My question is, what happens if we have something like:
class Node{
public object value;
public Node next;
public Node(object o, Node n) { value = 0; next = n;}
}
//...some code
{
Node a = new Node("a", n...