Garo Garabedyan's Divergent Thinking Blog

Garbage Collection in Java and Design Patterns

with 2 comments

Managing object deletion in Java is made automatically by Garbage Collector. Having this in mind it is crucial to know how to implement some patterns (like the Observer) which has a communication line (realized with storing refs) between objects.

Instead of the default object reference I offer you to use java.lang.ref.*

It is important to use not default object references in order instruct Garbage Collector to delete the object when up to him are only weak object references (which refs are supposed to keep the object in some pattern but not to keep it away of Garbage Collector).

Advertisements

Written by garabedyan

January 8, 2008 at 22:05

2 Responses

Subscribe to comments with RSS.

  1. good content….excellent topic

    gyani

    May 19, 2008 at 10:38

  2. […] https://garabedyan.wordpress.com/2008/01/08/garbage-collection-in-java-and-design-patterns/ Possibly related posts: (automatically generated)Garbage Collection in Java and Design PatternsObserver Design PatternOptimizing SQUID in Linux […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s