I was wondering how the garbage collector in Java deals with the following situation.
Object A has a reference to Object B and Object B has a reference to Object C.
The main program has a reference to Object A.
So you can use Object B trough Object A, and Object C trough Object B trough Object A.
What happens to Object B and Object C...
I asked a question about Garbage Collection in Java in this topic.
But the answer I got, gave me another question.
Someone mentioned that classes can be collected by the garbage collector too.
Is this true?
And if it is true, how does this work?
...
What are the reason/s behind other languages not having a Garbage Collector?
EDIT: Why garbage collection is not built-in for these other languages? why do programmers given the responsibility to collect?
EDIT: All of the questions if possible please :)
...
The heap memory is garbage collected in Java.
Is the stack garbage collected as well?
How is stack memory reclaimed?
...
Hello.
I have a CFC as singletone object in Application scope.
One of the methods is used for massive data processing and periodically causes the "Java heap space" errors.
EDIT All variables inside the method are VAR-scoped, so they should not be kept in the object scope when invokation ended.
It can be a bit dumb question for Java p...
I have a server application that, in rare occasions, can allocate large chunks of memory.
It's not a memory leak, as these chunks can be claimed back by the garbage collector by executing a full garbage collection. Normal garbage collection frees amounts of memory that are too small: it is not adequate in this context.
The garbage coll...
I'm trying to write a drop-in replacement for System.Media.SoundPlayer using the waveOut... API. This API makes a callback to a method in my version of SoundPlayer when the file/stream passed it has completed playback.
If I create a form-scoped instance of my SoundPlayer and play something, everything works fine because the form keeps ...
I have a JavaScript widget that is hosted on websites. This widget tracks state in a number of variables in its local namespace. Moreover, it attaches listeners for several events, such as mouse movement.
Should I explicitly destroy both state-tracking variables and detach event listeners on window unload? Or is it ok to rely on the bro...
The system I work with is creating a whole lot of objects and garbage collecting them all the time which results in a very steeply jagged graph of heap consumption. I would like to know which objects are being generated to tune the code, but I can't figure out a way to dump the heap at the moment the garbage collection starts. When I tri...
Hi everybody,
in a PHP program, I sequentially read a bunch of files (with file_get_contents), gzdecode them, json_decode the result, analyze the contents, throw the most of it away, and store about 1% in an array.
Unfortunately, with each iteration (I traverse over an array containing the filenames), there seems to be some memory lost ...
Hi,
For a web application developed on ASP.NET, we are finding that for user control files (ascx) we are returning long strings as a result of method calls. These are embedded in the ascx pages using the special tags <% %>
When performing memory dump analysis for the application, we find that many of those strings are not being garbage...
I know my way around Objective-C and I have experience with garbage collection from .NET, although I never used it in objective-c. I write my code without using it.
Now I'm thinkig about using one of the frameworks (Blocks) which is available as GC-only. My question is - can I still use the framework without any changes to my current no...
I have a page, when loaded it does some stuff with JQ.
In the next phase I want to load mootools and remove all JQ stuff, to avoid collisions and to avoid memory leaking.
I am not giving you the all picture (to simplify the question), but assume I am not doing something stupid here, and it needs to be done how I am asking it.
...
I know this may be a dumb question, but my background is more in c++ and managing my own memory.
I am currently cutting down every single allocation that I can from one of my games to try and reduce the frequency of garbage collection and perceived "lag", so for every variable that I create that is an Object (String and Rect for example...
I know I learnt this on the SCJP syllabus, but it escapes me.
What's the term for a set of objects that refer to each other but are no longer accessible from your program (and are thus eligible for garbage collection)?
...
Consider an object declared in a method:
public void foo() {
final Object obj = new Object();
// A long run job that consumes tons of memory and
// triggers garbage collection
}
Will obj be subject to garbage collection before foo() returns?
UPDATE:
Previously I thought obj is not subject to garbage collection until fo...
I'm performance tuning interactive games in Java for the Android platform. Once in a while there is a hiccup in drawing and interaction for garbage collection. Usually it's less than one tenth of a second, but sometimes it can be as large as 200ms on very slow devices.
I am using the ddms profiler (part of the Android SDK) to search o...
Hi.
I am trying to find a memory leak using ants memory profiler, and I've encountered in a new term:
Pinned objects.
Can some one give me a good & simple explanation about what this objects are, How can I pinn/Unpinn objects, and detect who pinned objects?
Thanks
...
How does the garbage collector determine whether an object is garbage? Does it refer to the stack to check the references to the space allocated in the heap?
...
Say there are two objects, A and B, and there is a pointer A.x --> B, and we create, say, WeakReferences to both A and B, with an associated ReferenceQueue.
Assume that both A and B become unreachable. Intuitively B cannot be considered unreachable before A is. In such a case, do we somehow get a guarantee that the respective references...