Hi guys,
I developed a few classes last month. They grow big (round 30-40 Methods each class).
I never take a thought of Memory Leaks, GarbageColletor or something like this (I must say this is my first own big project).
Now I have classes with Methods, 15 Classes Round About, each class min. 20 methods. 50% are Linq-Classes in the DA...
I want to store per-thread data in an ADO.NET Data Service. Is it safe to use the ThreadStatic attribute on my thread-specific static variable, or will I run into problems? My concern is that my ThreadStatic variable(s) won't be garbage collected after the request is completed and the thread dies.
If there's a better way to do what I'm...
I have the need to continuously build large strings in a loop and save them to database wich currently occasioanlly yields an OutOfMemoryException.
What is basically going on here is I create a string using XmlWriter with StringBuilder based on some data. Then I call a method from an external library that converts this xml string to so...
I am looking for a managed/unmanaged API that will allow me to find which objects reference another object and are potentially keeping it from being garbage collected.
Such an API might look like this:
var foo = new Foo();
var bar = new Bar();
bar.Foo = foo;
var references = GC.GetReferencesTo(foo);
// references is an array that con...
So I've finally located a problem I have with growing memory consumption. It's the class below, which for some reason doesn't get garbage collected. What would be the problem?
The idea of the FastBitmap class is to lock the bitmap data of a bitmap image once to avoid locking/unlocking on each call to GetPixel/SetPixel.
public unsafe cl...
I'm trying to find a programming language I feel really comfortable learning and using for desktop/GUI application development. I realize it's unlikely that any language meets ALL of these criteria, but I'd like to find one that meets as many as possible. I've listed the following features ROUGHLY in order from most desirable/important t...
How do I compare memory heap dumps in Netbeans?
What I have done is to configure my project to use profiling, then added several profiling points at chosen lines of code (similar to setting breakpoints). These profiling points trigger a "snapshot", which creates a memory dump.
As my application is running, the profiling tab lists each ...
Is it possible to get a notification when a long GC cycle occurs?
I'd like to write to our specific log when this happens.
...
I am playing around with the garbage collector in C# (or rather the CLR?) trying to better understand memory management in C#.
I made a small sample program that reads three larger files into a byte[] buffer. I wanted to see, if
I actually need to to anything in order to handle memory efficient
it has any impact when setting the byte...
Recent JVM's have a lot of XX parameters for garbage collection (see here for example), but what are the options which can make a client side Swing application really perform better?
I should note that one of the things that really annoys me on client side java applications is the large delay in stop-the-world garbage collection. In Int...
Suppose I have Two Objects:
object1, object2
When I do the following assign:
object2.Foo = object1.Foo; //Edit: where Foo is a reference type
What does the garbage collector do:
Does it collect object1, while perserving the value assigned to object2.Foo?
Or, Does object1 persist until object2 is collected because object2.Foo refe...
What happens to the WeakReference when the target object referenced by WeakReference.Target has been garbage collected? Does the WeakRerence stay alive and keeps existing?
The reason why I am asking is that I have a list of WeakReferences stored in a List. During runtime new WeakReferences constantly are getting added to that list. Now w...
I found the JVM flags here. Is there a more detailed explaination of what exactly they do?
...
I have a structure something like this
struct MyStructure
:IFoo
{
}
and a method like this:
public BarThisFoo(IFoo a)
{
}
my question is does passing the structure into that method "box" the structure, thus causing a garbage allocation?
Addendum:
Before anyone says it, garbage collection is not free in this application, it's ...
Due to the overhead of calling the garbage collector in the CLR, is it more efficient to leave it, or force to garbage collection when objects go out of scope?
...
I have a few classes that hold references to other classes through IDictionary instance members.
Like so:
class A
{
private readonly Dictionary<int, B> _particles = new Dictionary<int, B>();
public void CreateNewB(int someInt)
{
var b = new B();
if (!_particles.ContainsKey(someInt)
_particles.Add(someInt, b);
...
Does setting the object to null make it MARKED for GC?
EDIT: A class has got multiple static methods. when using these methods in your program, what is the best way to ensure the objects are marked for GC after a certain point?
...
I was thinking about garbage collection on the way home, and I began wondering, why does the garbage collector totally freeze execution of a program? Personally I would have designed it to block any threads which try to allocate a new object, but threads which were running would be left alone.
I can't imagine any situation where this wou...
We're seeing ConnectException with message "Connection refused" sporadically appearing at times when connecting to our Tomcat server. Could these be caused by long GC cycles?
(We're activating up the relevant JVM flags to get more log messages on GC cycles, but I thought to ask this here anyways)
...
Question:
I want to ask a question in response to Mike Rosenblum's answer to this question. The question was about cleaning up Excel interop objects. Several solutions where suggested (e.g. wrappers, not using more than one dot, killing the excel process), but I liked Mike Rosenblum's solution to this problem the most (lengthy article a...