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
#question.Write a program to find the area under the curve y = f(x) in java.

1. "Classes are statically loaded with Java's "new" operator." This would imply that static methods could be executed without the class being loaded. 2. "Unlike the static loa

Include Photo Upload feature to Android App with Google App Engine Project Description: I have one small Android App skeleton that requires some features added to and backed

i have got project of Vending machine. would you please help me about how to start and how to use coding.thanks

How DoS attack is a cyber crime? For what cyber crime can be used? DoS stands for Decline of Service and it is a cyber crime as it jams and within a few cases shut down the goa

Write a Java application to simulate a bank system. In the system, customers can open new bank accounts with the bank, and register/use an online account to manage their bank accou

Hi, I have an android sdk assignment which is due monday night. The user will enter the following information. url address user name password 12

Normal 0 false false false EN-IN X-NONE X-NONE MicrosoftInternetExplorer4

Hi, For my network and security class. I have a project where I need to create a program that take an input and encrypts it and then you can also enter that value into another tex