• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 302
  • Last Modified:

Object Deallocation

HSSFWorkbook hsswb = new HSSFWorkbook();
    HSSFSheet sheet = hsswb.createSheet("Abstract collection report");


If i declare this type of object in JSP and do not deallocate them
what will be the effect..

Is it necessary to do it..
0
Ritug
Asked:
Ritug
  • 5
1 Solution
 
sompol_kiatkamolchaiCommented:
You do not need to do that. Garbage collector will help you maintain unused instance of object.
It will cleanup automatically if there is no reference to that object.
0
 
sompol_kiatkamolchaiCommented:
In more detail about garbage collection.

Garbage collection is an mechanism that java virtual machine use for maintaining memory. The object that is not used anymore which JVM detect by check whether there is any reference to it or not. If not the container will decide to garbage that object from memory. We will not know when container(JVM) will decide to do that. Container start to do it by themselve.

Here is an example

String a="abc";  // this will create instance of string "abc" in memory and point or reference by variable a
a=null; // set a reference to null so "abc" instance can not refer to anymore
//container will clean "abc" later....


Regards,

0
 
RitugAuthor Commented:
Thanks for assistance
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
sompol_kiatkamolchaiCommented:
Best of luck. :)
0
 
umangjoshiCommented:
set it to null, rest will be handle by garbage collector.
0
 
sompol_kiatkamolchaiCommented:
Please accept my answer if you feel your problem is over. :)
0
 
sompol_kiatkamolchaiCommented:
Thanks mate.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now