garbage-collection

How to clean up after using dojo ?

Hi, I have written an app using dojo that allocates a lot of data during its lifetime. Is there a way I can ensure that all the memory has been released when I am done? Is there a method like dojo.data.destroyAllStores() that I can use with the <body onunload> tag? Thanks. ...

Unload MovieClip before Removing?

Is it better to Unload a MovieClip before Removing it off the Stage, in order for its contents to get cleared from RAM and therefore free up RAM better? Adobe Flash AS2 Documentation: removeMovieClip() - Removes a movie clip instance. unloadMovie() - Removes the contents of a movie clip instance. ...

Does a running thread in an object prevent it from being garbage collected in java ?

Given the code: new Thread(new BackgroundWorker()).start(); Intuitively it feels like the BackgroundWorker instance should be safe from GC until the thread exits, but is this the case ? And why ? Edit: All this heat is basically generated by me asking at least two different questions in the same post. The question in the title has...

examples of garbage collection bottlenecks

I remembered someone telling me one good one. But i cannot remember it. I spent the last 20mins with google trying to learn more. What are examples of bad/not great code that causes a performance hit due to garbage collection ? ...

garbage collection Operation

Hey all, Can someone please explain me how garbage collection is working? (I'm using C# and Java). ...

How to iterate on the objects present in the .NET managed heap?

Is there a way in the .NET API to iterate on the managed objects present in the managed heap? We would like to add a routine at some points in our program which checks the presence of some objects in the managed heap. ...

Why is the Obj-C GC clearing my reference?

I am writing an Objective-C program that utilizes the garbage collector. I am getting *EXC_BAD_ACCESS* in some situations, the classic example of an object being "over freed". Using some of the debugging tips in this technote, namely MallocScribble and *AUTO_LOG_COLLECTIONS*, I can see that my object is being GC'd out from under me. Wi...

How can I determine what finalizers are being called?

Since a finalizer being called usually indicates a missing Dispose() call, I would like determine what finalizers are being called. ...

Garbage collector problem in C#

In C# code, I have three objects A, B and C. A and B each hold a reference to C. When A is destroyed I would like the reference from B to C to be deleted as well so that C can be destroyed by the Garbage Collector. Is there a way to do this without deleting it manually from B? (The destructor in C is not called before the reference fro...

C# vs Java Garbage Collector

Hi There Does anyone know the major differences between the Java and C# garbage collectors? A web search has not revealed much, and it was a question that came up in a test. Thanks, Mike ...

.net Garbage Collection and managed resources

Is the memory from primitive data types (int, char,etc) immediately released once they leave scope, or added to garbage collection for later release? consider: For x as integer=0 to 1000 dim y as integer Next If this doesn't add 1000 integers to the garbage collector for clean up later, how does it treat string objects? would this cr...

How to get a CS paper published when not in academia?

I've implemented a newer GC algorithm and thought my findings could help. What should I do? Publish a blog? Do my best to write a paper and/or just start submitting abstracts to journals? I don't have any academic credentials myself. Should I start emailing local Professors to see if they could help me write it? Email professors w...

Garbage collection in yield Methods

Say I have a method like this (stolen from a previous SO answer by Jon Skeet): public static IEnumerable<TSource> DuplicatesBy<TSource, TKey> (this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) { HashSet<TKey> seenKeys = new HashSet<TKey>(); foreach (TSource element in source) { // Yield it if the...

Session containing items implementing IDisposable

In ASP.NET if items are left in the session state that Implement IDisposable but are never specifically removed and disposed by the application when the session expires will Dispose be called on the objects that any code in Dipose() will execute? ...

Do I need to retain properties when using Objective-C 2.0 garbage collection?

I'm using garbage collection in Objective-C 2.0. Do I need to retain properties? Eg. @property (nonatomic, retain) NSMutableArray *myArray; Or is this enough: @property (nonatomic) NSMutableArray *myArray; I initialize the array like this: self.myArray = [NSMutableArray array]; ...

Should I call Close on HttpWebResponse, even if it's inside a using statement?

The question says it all, I have some code like, this code is used very heavily: using (HttpWebResponse response = _GetHttpWebResponse(requestURIString, msgBody, methodType, contentType, headers)) { //*** do something with it... //*** Call response.Close() ??? } The code works fine today, but the connections to the serv...

Is it necessary to explicitly remove event handlers in C#

I have a class that offers up a few events. That class is declared globally but not instanced upon that global declaration--it's instanced on an as-needed basis in the methods that need it. Each time that class is needed in a method, it is instanced and event handlers are registered. Is it necessary to remove the event handlers explici...

What's the right way to install gems in a GC Patched ruby?

I want to install a GC Patched Ruby to do a memory profiling on my app. I followed the instructions at http://guides.rubyonrails.org/performance_testing.html#gc and installed a ruby instance at my home dir (I already have another "official" instance for development). This GC Patched ruby instance is working fine. The problem is when I n...

memory use in large data-structures manipulation/processing

I have a number of large (~100 Mb) files which I'm regularly processing. While I'm trying to delete unneeded data structures during processing, memory consumption is a bit too high. so, I was wondering is there a way to 'efficiently' manipulate large data, e.g.: def read(self, filename): fc = read_100_mb_file(filename) self.proc...

Applying pin_ptr to fields

I have some C++/CLI code that needs to pin a struct (value type) in order to pass it back to unmanaged code. The unmanaged code knows enough to unmarshal what it needs. The struct may contain managed strings and so I also need to pin these before calling the unmanaged function. The problem is that my managed helper class is generic: ...