• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Heap size and SoftReference

 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If command-line options (-Xmx, -Xms, -XX:MinHeapFreeRation, -XX:MaxHeapFreeRatio) allow, Java will grow and shrink the heap according to the demands of the running application. I've played with these settings and they all seem to do what I expect.

However, there is a complication about which I have been unable to find any information. This involves SoftReferences, of which I have lots, for various caches.

When deciding whether to grow or shrink the heap, does Java include softly-referenced objects in its calculation of required memory?

In other words, will Java clear all my SoftReferences before deciding it has to grow the heap? Or will it grow the heap to avoid having to do so?
 
reply
    Bookmark Topic Watch Topic
  • New Topic