Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Object Deallocation

Posted on 2004-08-16
7
Medium Priority
?
299 Views
Last Modified: 2010-08-05
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
Comment
Question by:Ritug
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
7 Comments
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11808668
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
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11808702
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
 

Author Comment

by:Ritug
ID: 11809065
Thanks for assistance
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11809075
Best of luck. :)
0
 
LVL 1

Expert Comment

by:umangjoshi
ID: 11809752
set it to null, rest will be handle by garbage collector.
0
 
LVL 11

Accepted Solution

by:
sompol_kiatkamolchai earned 2000 total points
ID: 11810394
Please accept my answer if you feel your problem is over. :)
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 12003814
Thanks mate.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read on to get a few ideas on how to promote your next corporate event.
Check out what's been happening in the Experts Exchange community.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question