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
Write the hashCode() method of java.lang.Object Anytime you override equals() you should also override hashCode(). The hashCode() method should ideally return the similar int f

To use the DispatchAction, follow these steps: ? Make a class that extends DispatchAction (instead of Action) ? In a new class, add a method for each function you need to per

Integration: Neo4J, OpenGeo, Ikanow Project Description: I have an ongoing project to loosely integrate a variety of existing Open Source products: OpenGeo (geospatial server

You have recently joined a games company. The SQA manager has given you the task of improving the code quality of simple games. This is a standard task which the SQA manager gives

Is it possible to create any dialog window in Oracle in Java stored procedure?

JavaServer Faces(JSF) is a framework for building web-based user interface in Java. Unlike Swing, JSF provides widgets like buttons, hyperlinks, checkboxes, etc. in dissimilar ways

Medical Services Referral System:       Role : Websphere Administrator       Involved in Exposure to load balancing tools (BigIP, WAS plug-ins) and Siteminder.

Project Description: We are seeking software engineers to create a plug-in for Adobe after Effects (CS4 and above) that allows 3D extrusions for a layer. We are seeking somethin

Instructions: Please make sure your solutions are original, in your own words, expressing your own ideas. Any copying from others' home-works, text books or online sources will

A process is an execution of a code but a thread is a single execution sequence within the process. A process may contain multiple threads. A thread is sometimes named a lightweigh