garbage-collection

Why don't purely functional languages use reference counting?

In purely functional languages, data is immutable. With reference counting, creating a reference cycle requires changing already created data. It seems like purely functional languages could use reference counting without worrying about the possibility of cycles. Am is right? If so, why don't they? I understand that reference counting i...

Is GC.SuppressFinalize guaranteed?

My observation in practice has been that GC.SuppressFinalize does not always suppress the call to the finalizer. It could be that the finalizer gets called nontheless. I wonder therefore whether GC.SuppressFinalize has the nature of a request rather than a guarantee by the system? More Information Following information may help provi...

"Island of isolation" of Garbage Collection

Could anyone please explain the concept of Island of isolation of Garbage Collection? ...

Experience using gcServer="true" to set garbage collector for .NET

Someone has used a configuration enabling the garbage collector optimized for multi-processor machines using Aspnet.config with : gcServer enabled="true" gcConcurrent enabled="true" There was improvement in the performance of your site? It was noticed a problem? ...

Mark phase misdetection on garbage collection for C

Hello, I've looked at Conservative GC Algorithmic Overview Can a misdetection happen in the 'marking' part? If some data is stored and by coincidence happen to be the same as an address of an allocated memory, will the collector keep the memory ? ...

Cocoa development: malloc: free_garbage: garbage ptr = 0x18a15e0, has non-zero refcount = 1 error

I'm developing a Cocoa app, and every so often when running my app in Xcode I get the following sorts of messages in the debugging console: <My app name>(952,0xb0103000) malloc: free_garbage: garbage ptr = 0x107b2f0, has non-zero refcount = 1 I turned on MallocStackLogging and NSZombieEnabled and did a malloc_history on a couple of...

How do I erase passwords from memory when using Username tokens with JBossWS?

I'm using JBoss Web Services for a payment service application. At some point I need to make remote SOAP calls to a payment service provider, and I need to authenticate with a Username token. The only way I know how to do this with JBossWS is like this: Map<String, Object> requestContext = ((BindingProvider)port).getRequestContext(); r...

Convenient way to call GC::KeepAlive in C++/CLI scenarios?

Hi I'm writing some managed wrappers using C++/CLI. The problem is that the GC sometimes disposes the object while I'm using unmanaged members from it. (I think this behaviour is insane but this is another topic). For more details see: http://stackoverflow.com/questions/134653/finalizer-launched-while-its-object-was-still-being-used ht...

Android: Track number of objects created

I'm porting a game to Android (there's a lot of code and very little of it is mine), and DalvikVM is telling me (through LogCat) all about the garbage collection. At some point in the code, I get a stream of "GC freed x objects / x ms" messages, basically informing me that ~150,000 objects have just been deleted and it's taking a full se...

Can a Non-Interpreted language have a Garbage Collector ?

Is it possible for a Non-Interpreted language to have a Garbage collector. Interpreted languages have the Interpretor executing the Program line by line so the Interpretor might just as well provide a runtime with a GC. But is it possible to have a Garbage collector for any other language without building the GC in your code itself ? ...

Garbage Collection in C++/CLI

Consider the below: #include <iostream> public ref class TestClass { public: TestClass() { std::cerr << "TestClass()\n"; } ~TestClass() { std::cerr << "~TestClass()\n"; } }; public ref class TestContainer { public: TestContainer() : m_handle(gcnew TestClass) { } private: TestClass^ m_handle; }; void createContainer()...

.NET Garbage Collector - what is its thread priority?

I have found some great articles (Maoni, Richter #1, Richter #2) giving many details as to the theory and practice of the GC, yet I cannot find anything that states how the GC's thread priority is set. The closest I've found is this one that states that the Finalizer thread "runs asynchronously to the application and at a high priority....

Returning from a function without destroying objects

Hi, I have a function in C# 2.0 called Foo(), that returns a value of the type boolean. I am instantiating an object in the function that I am not destroying before returning the boolean value. I want to know whether is it necessary to destroy the objects created before returning the value? thanks. ...

Controlling Lua5.1's garbage collector

OK so I have a C++ class that is exposed to Lua using SWIG. The script creates the object but a manager class also has a pointer to the object so it can be modified in C++(or another script) for whatever reason. The problem is that when the script finishes the object is freed, how can I control what the Garbage collector collects withou...

.NET generation 0 heap size

Is it possible to set a minimal size of a generation 0 heap in .NET? I have a folowing sistuation. I have a function that allocates around 20-30 MB of 1KB objects, does something with them, and terminates, leaving all the allocated objects to be GC-ed. Now, in Performance Monitor, I can see that generation 0 heap size is 5-6 MB, which i...

How does garbage collection in Python work with class methods?

class example: def exampleMethod(self): aVar = 'some string' return aVar In this example, how does garbage collection work after each call to example.exampleMethod()? Will aVar be deallocated once the method returns? ...

Does setting Java objects to null do anything anymore?

I was browsing some old books and found a copy of "Practical Java" by Peter Hagger. In the performance section, there is a recommendation to set object references to null when no longer needed. In Java, does setting object references to null improve performance or garbage collection efficiency? If so, in what cases is this an issue? Co...

Garbage collection of static members

Will static members be ever collected by the garbage collector? ...

Best Practice for view data population?

I've been working on a .NET application and experiencing a memory error (I'm a java developer that can do other things), I've been thinking about performance. What I'm posting about was not the memory problem. The memory problem just started me thinking. I've repeated a trend in my ASP.NET application that I've used on countless J2EE ap...

How to ensure JVM starts with value of Xms

When I run a java program with the starting heap size of 3G (set by -Xms3072m VM argument), JVM doesn't start with that size. It start with 400m or so and then keeps on acquiring more memory as required. This is a serious problem for me. I know JVM is going to need the said amount after some time. And when JVM increases is its memory a...