Garbage collection model, JAVA Programming

This assignment is about experimenting with the Java runtime system's garbage collection model, and comparing it with the C++ manual memory allocation model. Below is the Garbage Java class/program that creates Chair objects and counts the number of objects having been created. The Chair class defines a finalize method that is called when the Chair objects are garbage collected.

After having created the objects, the Garbage program has three options, triggered by command-line arguments: (1) "before": calls the garbage collector manually, then runs finalization methods, (2) "after": instructs the garbage collector to run all finalization methods without explicitly calling for garbage collection to occur, and finally (3) if no command line arguments are provided, the normal garbage collection procedure occurs, without any explicit call directing how it should proceed.

Part 1:

Run the Garbage program and observe how it behaves using each of the three cases described above. Explain the results in terms of how the garbage collection system is behaving in each case.

Part 2:

Write a similar program in C++ using pointers to Chair objects, where the implementation behaviour of the finalize method is put into a destructor. Explain what happens when all the objects are explicitly deleted, and when they are not. Explain the differences with some of the results you got in part 1.

Part 3:

Re-write the program written in part 2, this time using STL C++ auto_ptr pointers to Chair objects and do the same experimentation. Explain your results compared to the results you got in parts 1 and 2.

Posted Date: 3/2/2013 1:05:36 AM | Location : United States







Related Discussions:- Garbage collection model, Assignment Help, Ask Question on Garbage collection model, Get Answer, Expert's Help, Garbage collection model Discussions

Write discussion on Garbage collection model
Your posts are moderated
Related Questions
Since there are only a finite number of bonds available in the market. There will always be "holes" to fill in when defining a yield curve in continuous time. A common approach is

Service Oriented Architecture Service Oriented Architecture (SOA) is an evolution of the fundamentals governing a component based development. Component based development gives

We are in need of Programmer In search of someone who know java well enough to work under my in-house programmer and take work form him to keep the project moving. The project d

What is bandwidth? In a general way Bandwidth is a capacity of communication channel of carrying data.

JZEBRA Integration into (Open ERP) Web Client Local Spooling/Printing to Local Print Device on ERP Client side Project Description: JZEBRA Integration into Open ERP Web Clien

Explain Choosing Font Faces and Sizes in java AWT packages? Choosing a font face is simple. First you create a new Font object. Then you call g.setFont(Font f). To instantiate

What are the conditions for exiting the while loop?


For this assignment we will be solving the producer-consumer problem with a bounded buffer. You are required to implement this assignment in Java. There are three components in thi

1. Pre-translated: Before the JSP file has been compiled and translated into the Servlet. 2. Translated: The JSP file has been compiled and translated as a Servlet. 3. I