Suppose I have some simple struct like this:
public struct WeightedInt {
public int value;
public double weight;
}
Then let's say I have a collection of instances of this structure:
List<WeightedInt> weightedInts = new List<WeightedInt>();
As I understand value types versus reference types, value types are allocated on the ...
I heard that Python has automated "garbage collection" , but C++ does not. What does that mean?
...
.NET 3.5, I've got some classes which stores up to 1MB of strings. Even though I need the object for a really long time I don't need to store the string for a long time.
How can I truly remove the string from memory without disposing the parent object.
Is it a good practice to use "myString = null" in this case? or shall wrap it in a ...
Recently I heard Kirk Pepperdine speak about changing garbage collectors for better performance -- but what exactly does that mean and what makes one garbage collector better or different than the other?
...
Hi,
Isn't it possible to get an event when the GC begins? I want to time each individual GC so I can see if pauses in my server are due to GC or something else.
The GC pauses all .NET threads while running, right? (Except the thread that it runs on, of course). How about unmanaged threads?
Thanks!
...
I am developing a pretty extensive system in .NET, which involves a lot of system programming. Most time, I'm using the IDisposable pattern to handle resource disposal, but sometimes this isn't applicable (or left out by mistake) and resource gets destroyed during Finalize(). This might happen in COM interop, or when destructor calls Dis...
If you have a brush and pen as in:
Brush b = new SolidBrush(color);
Pen p = new Pen(b);
and dispose them like so:
b.Dispose();
p.Dispose();
How would you dispose it if it was:
Pen p = CreatePenFromColor(color) which would create the brush and pen for you? I can't dispose the brush inside this method, right?
Is this a method not t...
We are developing a rather large Windows Forms application. In several customers' computers it often crashes with OutOfMemory exception. After obtaining full memory dump of the application moments after the exception (clrdump invoked from UnhandledException handler) I analyzed it with ".NET Memory Profiler" and windbg.
The Memory Profil...
I have created dll in C# 3.5 which does some memory intensive matrix calculations where matrices get created and disposed a lot. Everything works fine if dll is called from .Net app but if it is called from C++ created app memory usage just climbs until the function that uses matrices is done. I guess there is a problem with a automatic ...
What do you think about the concept of using ORO instead of traditional Garbage Collecting? It doesn't seem to be widely adopted, and is more or less argumentative, but it can provide these benefits as I know:
Synchronous execution of code: your program will always take known amoun of time to execute.
Simplification of platform, you'r ...
I've built a video viewer that is a Safari plugin that displays video from networked devices. The viewer reads bitmap images, prepares them, and sets them on the NSImageView object as follows:
NSBitmapImage *bmImg = [[NSBitmapImage alloc] initWithBitmapDataPlanes: . . .]
NSImage *img = [[NSImage alloc] init];
[img addRepresentation:bmI...
Is there a way to free memory in Java, similar to C's free() function? Or is setting the object to null and relying on GC the only option?
...
I have an application which I've developed which queries Active Directory information and stores about 15 properties into a Datatable which is kept in memory.
I need to decrease the amount of "Commit" memory it is setting aside.
The application stays active in the system tray and allows for quick searching of information along with pic...
Hi.
I have a double linked list (queue) I have made on my own.
I am wondering, to clear the linked list, is it enough to simply remove the head and tail references?
E.g
public void Clear()
{
Head = null;
Tail = null;
}
I am imaging a domino effect, but I am having a hard time testing it.
It WILL make the whole object appea...
I would like to understand garbage collection in objective-c.
I know how to work with memory in C-like languages and in languages where I don't care about memory. But I don't understand when to use autorelease, retain, dealloc and everything else, so I get errors and memory leaks.
Could someone propose me a good tutorial to understand ...
What is it that determines when the garbage collector actually collects? Does it happen after a certain time or after a certain amount of memory have been used up? Or are there other factors?
...
I'm working on a game for the xbox360, using XNA. On the Xbox the garbage collector performs rather badly compared to the one on a PC, so keeping garbage generated to a minimum is vital for a smoothly performing game.
I remember reading once that calling a delegate creates garbage, but now for the life of me can't find any references to...
The CLR Profiler can also reveal which methods allocate more storage than you expected, and can uncover cases where you inadvertently keep references to useless object graphs that otherwise could be reclaimed by GC. (A common problem design pattern is a software cache or lookup table of items that are no longer needed or are safe to r...
I was reading about the Form's events in VB6 such as "Unload" "QueryUnload" and "Terminate", and about the "End" statement:
http://articles.techrepublic.com.com/5100-10878%5F11-5533338.html
http://visualbasic.freetutes.com/learn-vb6-advanced/lesson6/p5.html
I used to have problems with a VB6 app (it calls a lot of windows' apis). When I...
Does JavaScript support garbage collection?
For example, if I use:
function sayHello (name){
var myName = name;
alert(myName);
}
do I need to use "delete" to delete the myName variable or I just ignore it?
...