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

Area under curve., write a program to find the area under the curve y=f(x) ...

write a program to find the area under the curve y=f(x) between x=a and x=b,integrate y=f(x) between the limits of a and b.   #include float start_point,

Train ticket, Write a program that manages a list of train tickets, JAVA Pr...

Write a program that manages a list of train tickets, JAVA Programming

Package inheritance hierarchy program, (Package Inheritance Hierarchy) Pack...

(Package Inheritance Hierarchy) Package-delivery services, such as FedEx®, DHL® and UPS®, offer a number of different shipping options, each with specific costs associated. Create

I want customize tumblr theme, I need Customize Tumblr theme Project Des...

I need Customize Tumblr theme Project Description: I have a blog here I would like to customize it as follows; 1) Modify the horizontal navigation from the bottom of th

Create a generic class with a type parameter, 1. The purpose of this proble...

1. The purpose of this problem is to practice using generics.  Create a generic class with a type parameter that simulates drawing an item at random out of a box. For exampl

What is constraints explain with example, What is Constraints explain with ...

What is Constraints explain with example? One of the purposes to use constructors and setter techniques rather than directly accessing fields is to enforce constraints. For exa

Why uploading a web page is important, Why uploading a web page is importan...

Why uploading a web page is important? Describe in 2 - 3 lines? Through only uploading webpage we could place our data so that another can reach up to what we have loaded. Uplo

What is lookupdispatchaction, The LookupDispatchAction is a subclass of Dis...

The LookupDispatchAction is a subclass of DispatchAction. It does a reverse lookup on the resource package to get the key and then gets the method whose name is associated with the

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