aspose file tools
The moose likes Java in General and the fly likes How to remove strings from String constant pool ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "How to remove strings from String constant pool ?" Watch "How to remove strings from String constant pool ?" New topic
Author

How to remove strings from String constant pool ?

Jay Pawar
Ranch Hand

Joined: Aug 27, 2004
Posts: 411
Hello All,
Is there a way to remove the strings (declared by my program) stored in String constant pool ?

TIA


Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24057
    
  13

No. I've heard, however, that modern JVMs use a "WeakHashMap" from which unused constants can be garbage-collected if necessary.


[Jess in Action][AskingGoodQuestions]
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Given that Java is a garbage collected environment, you cannot destroy any objects. However, you can make objects available for garbage collection, including string constants.

http://jqa.tmorris.net/GetQAndA.action?qids=68&showAnswers=true


Tony Morris
Java Q&A (FAQ, Trivia)
Jay Pawar
Ranch Hand

Joined: Aug 27, 2004
Posts: 411
Thanks Ernest and Tony for your responses. By the way, Tony, excellent explanation on that FAQ# 45
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to remove strings from String constant pool ?
 
Similar Threads
== and equals()
doubt on page-420 k&b
String constant pool or heap
Garbage collection question
String object ?