Garbage collection model, JAVA Programming

Assignment Help:

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.


Related Discussions:- Garbage collection model

In javascript, In JavaScript, what is event handling? What are the two type...

In JavaScript, what is event handling? What are the two types of events? In JavaScript capturing events and responding to them is event handling. The system sends events to the

Develop a visual design in java, Player Ship Appearance: • Your ship mu...

Player Ship Appearance: • Your ship must be either a nice-looking sphere (left image above), or a nice-looking sphere with a "mouth" (middle image above), depending on variant.

Gameplay software, Individual Assignment Rework Asteroids to have a di...

Individual Assignment Rework Asteroids to have a different gameplay In the previous assignments, we have developed an Asteroids game. In this assignment, we are going to u

Thread, what is join in java Thread

what is join in java Thread

Idea for a project, I want to get some idea about how i can make a project ...

I want to get some idea about how i can make a project on "Free Lancer Teaching."

Web-based client program, Why are JSP pages the preferred API for creating ...

Why are JSP pages the preferred API for creating a web-based client program? Because no plug-ins or security policy files are required on the client systems (applet does). Also,

I clicker, i am to find 75% of i clicker score.Each correct answer is worth...

i am to find 75% of i clicker score.Each correct answer is worth 2points and an incorrect 1point. Express grade as a percentage (i.e the max is 100%). e.g 1 no i clicker question

Rmi client program, In a RMI Client Program, what are the excpetions which ...

In a RMI Client Program, what are the excpetions which may have to handled Ans) a. MalFormedURLException b. NotBoundException c. RemoteException

Explain switch statement in java language, Explain switch statement in java...

Explain switch statement in java language? Switch statements are shorthands for a certain type of if statement. It is not common to see a stack of if statements all related

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd