garbage-collection

gdb: set a breakpoint for a SIGBUS handler

I'm trying to debug a simple stop-and-copy garbage collector (written in C) using GDB. The GC works by handling SIGBUS. I've set a breakpoint at the top of my SIGBUS signal handler. I've told GDB to pass SIGBUS to my program. However, it doesn't appear to work. The following program (explained inline) shows the essence of my problem: #...

java garbage collection

I was going through this question on an SCJP preparation site . How answer A is correct? What is true about objects referenced by a, b, aa at the line labeled "// some code goes here"? class A { private B b; public A() { this.b = new B(this); } } class B { private A a; public B(A a) { this.a = a; ...

Allowing garbage collection of a class while an anonymous inner class instance is referenced elsewhere?

I have a class A: public class A { private B b = new B() { public void method() { do something } }; public B getB() { return b; } } public interface B { void method(); } The instance b has an implicit reference of the instance of its outer class (that can be referenced by this). Now another object gets a reference to this b ...

Garbage collection notification?

I'd like to register a callback with the JVM so I know when garbage collection is happening. Is there any way to do this? EDIT: I want to do this so I can log out when garbage collection happens in my application log, so I can see if it correlates to problems I'm seeing. Turning on -Xloggc is helpful, but it is a little tricky to inte...

PHP Unset via References

I have been reading the PHP manual about references and something is confusing me. It says that references are not pointers to memory addresses but rather... Instead, they are symbol table aliases. Isn't this essentially a pointer if the reference points to the symbol table entry which then points to a memory address? Edit: So...

How do garbage collection and background threads interact in .NET?

Let's say I create an object, and that object starts a thread, and gives one of its private instance methods to ThreadStart. Later, all references to that object are gone. What happens? Is the object is never garbage collected because the thread holds a reference to it through the this pointer? On the other hand, if I use a static method...

Freelists with concurrent allocators

Freelists are a common way to speed up allocation by reusing existing memory that was already allocated. Is there a way to use free-lists in a concurrent allocator, without incurring the overhead of a lock for every allocation (which would neutralize the intended performance gain of the freelist)? ...

Stack based memory allocation

With reference to Stack Based Memory Allocation, it is stated as "...each thread has a reserved region of memory referred to as its stack. When a function executes, it may add some of its state data to the top of the stack; when the function exits it is responsible for removing that data from the stack" and "...that memory on the stack i...

Garbage Collection and Threads

AFAIK when a GC is doing its thing the VM blocks all running threads -- or at least when it is compacting the heap. Is this the case in modern implementions of the CLR and the JVM (Production versions as of January 2010) ? Please do not provide basic links on GC as I understand the rudimentary workings. I assume global locking is the ...

Java Collections and Garbage Collector

A little question regarding performance in a Java web app. Let's assume I have a List<Rubrique> listRubriques with ten Rubrique objects. A Rubrique contains one list of products (List<product> listProducts) and one list of clients (List<Client> listClients). What exactly happens in memory if I do this: listRubriques.clear(); listRub...

how does flash handle garbage collection when it comes to adding movieclips directly to another

Just curious, If i nest a movieclip inside of another movieclip, and the nested movieclip is attached to a custom class. And that custom class has a Event.ENTER_FRAME listener. when I destroy the container movieclip, will flash get rid of the event listeners inside of nested movieclip's custom class ? May seem like a silly question but ...

How to programmatically determine a Cocoa plugin bundle's garbage collection settings?

On Mac OS X using Objective-C 2, plugin bundles can be compiled with one of three garbage collection settings: Not Supported Supported (-fobjc-gc) Required (-fobjc-gc-only) How can one programmatically query a compiled plugin bundle to determine which of these three settings was used? ...

Close SQL connection Java Webservice

Hello, I am programming a WebService in Java that create and call this class : public class Manager{ private Connection aConnection; public CacheManager(){ //We get a connection aConnection = java.sql.DriverManager.getConnection("jdbc:mysql://localhost/mydb?user=root&password="; ...

Leaking memory with Cocoa garbage collection

I've been beating my head against a wall trying to figure out how I had a memory leak in a garbage collected Cocoa app. (The memory usage in Activity Monitor would just grow and grow, and running the app using the GC Monitor instruments would also show an ever-growing graph.) I eventually narrowed it down to a single pattern in my code....

module level garbage collection in python

Let's say I have a module mod_x like the following: class X: pass x=X() Now, let's say I have another module that just performs import mod_x, and goes about its business. The module variable x will not be referenced further during the lifecycle of the interpreter. Will the class instance x get garbage collected at any point except...

Which object will be garbage collected ?

I wish to confirm which scenario will cause a Garbage Collection on the object myObj: Scenario 1 ArrayList arList = new ArrayList(); while(someCondition) { myObj = new MyObect(); // a custom object arList.add(myObj); } Scenario 2 ArrayList arList = new ArrayList(); while(someCondition) { myObj = new MyObect(); // a custom obj...

Delegate variables not garbage collected

Recently discovered that the variables inside ToGadget, and presumably the delegate as well, weren't getting garbage collected. Can anyone see why .NET holds a reference to this? Seems that the delegate and all would be marked for garbage collection after Foo ends. Literally saw *B*illions in memory after dumping the heap. Note: 'res...

Why is the maximum size of the Java heap fixed?

It is not possible to increase the maximum size of Java's heap after the VM has started. What are the technical reasons for this? Do the garbage collection algorithms depend on having a fixed amount of memory to work with? Or is it for security reasons, to prevent a Java application from DOS'ing other applications on the system by con...

C# .NET object disposal

Should be an easy one. Let's say I have the following code: void Method() { AnotherMethod(new MyClass()); } void AnotherMethod(MyClass obj) { Console.WriteLine(obj.ToString()); } If I call "Method()", what happens to the MyClass object that was created in the process? Does it still exist in the stack after the call, even thou...

Is following scenario called memory-leak in java? Is it not Garbage Collected?

If any object variable is still pointing to some object which is of no use, then JVM will not garbage collect that object and object will remain in memory creating memory leak In the above scenario there is possibility of memory leak.. Why is it not Garbage Collected? Can anybody elaborate on it? ...