I'm trying to understand how the concepts of young, old and permanent generations in the Java heap terminology, and more specifically the interactions between the three generations.
My questions are:
What is the young generation?
What is the old generation?
What is the permanent generation?
How does the three generations interact/rela...
As we know the java's garbage collector is a low priority thread. And in java we can create any thread with high priority. So is it possible to have our own customized garbage collector thread with variable priority (we can set depending on the level of memory management).
Did anybody tried that. If yes can you share some knowledge abou...
I am currently working on an application in C# that runs on an infinite loop with a Thread.Sleep call after each iteration of the other method calls. My main is -
static void Main(string[] args)
{
bool isOnlyInstance = false;
Mutex mutex = new Mutex(true, "RiskMetricsSensitivitiesDatabaseLoader", out isOnlyInstance...
Is there any possibility that a object which is not referenced anywhere and still existing on heap. I mean is there a possibility that a unused object getting escaped from garbage collector and be there on the heap until the end of the application.
Wanted to know because if it is there, then while coding i can be more cautious.
...
Hello,
I'm writing a semi-accurate garbage collector, and I'm wondering if there is a way to accurately detect the boundaries of the system-allocated stack for a given thread.
I need this so I can scan the stack for roots (pointers), and my current approach is to save the stack pointer when entering a new thread and when entering main()...
I'm looking for a way to control all business objects I create in my applications written in Delphi.
As an article on Embarcadero's EDN (http://edn.embarcadero.com/article/28217) states, there are basically three ways to do this. I'm mostly interested in the last one, using interfaces. That way, when the business object is no longer bei...
It took me a long time to realize how important and subtle having variables that:
1) exist on the stack
2) have their destructors called when they fall out of scope
are.
These two things allow things like:
A) RAII
B) refcounted GC
Interesting enough, (1) & (2) are not available in "lower" languages like C/Assembly; nor in "higher"...
Hi All,
I am a bit confused about the fact that in C# only the reference types get garbage collected.
That means GC picks only the reference types for memory de-allocation.
So what happens with the value types as they also occupy memory on stack ?
...
For example, in the below code an 'image'object will be created and then garbage collected at some unknown point in the future
void MyFunction() {
Bitmap image = RetrieveImage();
DoSomething(image);
}
What about
void MyFunction() {
DoSomething(RetrieveImage());
}
In this case is the object garbage collected once it m...
I am trying to profile a specific page of my ASP.NET site to optimize memory usage, but the nature of .NET as a Garbage Collected language is making it tough to get a true picture of what how memory is used and released in the program.
Is there a perfmon counter or other method for profiling that will allow me to see not only how much m...
As there is no garbage collection in Delphi, where exactly do you unload variables?
Say I have a type with a set of private vars.
Would it suffice to have a Destroy method that does this work?
Do I need to explicitly call this destroy method in my consuming classes?
...
I'm working on a Java server that handles a LOT of very dense traffic. The server accepts packets from clients (often many megabytes) and forwards them to other clients. The server never explicitly stores any of the incoming/outgoing packets. Yet the server continually runs into OutOfMemoryException exceptions.
I added System.gc() into ...
I'm not looking for the usual "you can only hint the GC in Java using System.gc()" answers, this is not at all what this question is about.
My questions is not subjective and is based on a reality: GC can be forced in Java for a fact. A lot of programs that we use daily do it: IntelliJ IDEA, NetBeans, VisualVM.
They all can force GC t...
I have an application which uses rather a lot of actors: 25,000 to be precise. It uses Scala 2.7.7 and is running on jdk6_u18. It basically listens to and processes market data and has very little state.
It starts at 8.02am every day and within the hour it has crashed with an OutOfMemoryError. "Aha" you say, "you have a memory leak!" Ex...
I have a theory that the CLR garbage collection mechanism means that I can get away with circular references in my object hierarchy without creating deadlocks for teardown and garbage collection. Is this a safe assumption to make? (Target language VB.NET)
...
I have a Windows.Forms app with a ListBox populated with Account objects.
When the user selects an Account from the list I attach an EventHandler responsible for updating the selected Account transactions in the event that there's any new ones while the user is looking.
private void listBox1_SelectedIndexChanged(object sender, EventArg...
I have several sections of code that I need to protect with a Mutex. The problem is that the code looks something like this:
lock(mylockobject) {
if(!foo())
throw new MyException("foo failed");
if(!bar())
throw new MyException("bar failed");
}
Using lock, it works as I'd like, but now I need to use a mutex. The obvious p...
VBScript guarantees that the GC will run after every line, so if you create an object and don't keep a reference, its destructor will be called at the end of the line. This allows you to do a number of interesting things, one of which is simulating optional arguments:
with foo(mandatoryArg)
.optArg = 42
end
Another is allowing for...
I have a cache folder that stores html files. They are overwritten when needed, but a lot of the time, rarely used pages are cached in there also, that just end up using space (after 5 weeks, the drive was full with over 2.7 million cache files).
Whats the best way to loop thru a directory that contains several hundreds of thousands o...
Here is scenario.
FormA loads.
ClassA is instantiated at the form class scope.
User does something that causes event ClassA.SomeEvent to be handled by method FormA.SomeEventHandler()
User closes FormA
Now what happens when the garbage collector makes its rounds?
Since FormA should be disposed, but a reference to it is made by ClassA.
...