24 |
24 |
25 # include "incls/_precompiled.incl" |
25 # include "incls/_precompiled.incl" |
26 # include "incls/_referencePolicy.cpp.incl" |
26 # include "incls/_referencePolicy.cpp.incl" |
27 |
27 |
28 LRUCurrentHeapPolicy::LRUCurrentHeapPolicy() { |
28 LRUCurrentHeapPolicy::LRUCurrentHeapPolicy() { |
29 snap(); |
29 setup(); |
30 } |
30 } |
31 |
31 |
32 // Capture state (of-the-VM) information needed to evaluate the policy |
32 // Capture state (of-the-VM) information needed to evaluate the policy |
33 void LRUCurrentHeapPolicy::snap() { |
33 void LRUCurrentHeapPolicy::setup() { |
34 _max_interval = (Universe::get_heap_free_at_last_gc() / M) * SoftRefLRUPolicyMSPerMB; |
34 _max_interval = (Universe::get_heap_free_at_last_gc() / M) * SoftRefLRUPolicyMSPerMB; |
35 assert(_max_interval >= 0,"Sanity check"); |
35 assert(_max_interval >= 0,"Sanity check"); |
36 } |
36 } |
37 |
37 |
38 // The oop passed in is the SoftReference object, and not |
38 // The oop passed in is the SoftReference object, and not |
50 } |
50 } |
51 |
51 |
52 /////////////////////// MaxHeap ////////////////////// |
52 /////////////////////// MaxHeap ////////////////////// |
53 |
53 |
54 LRUMaxHeapPolicy::LRUMaxHeapPolicy() { |
54 LRUMaxHeapPolicy::LRUMaxHeapPolicy() { |
55 snap(); |
55 setup(); |
56 } |
56 } |
57 |
57 |
58 // Capture state (of-the-VM) information needed to evaluate the policy |
58 // Capture state (of-the-VM) information needed to evaluate the policy |
59 void LRUMaxHeapPolicy::snap() { |
59 void LRUMaxHeapPolicy::setup() { |
60 size_t max_heap = MaxHeapSize; |
60 size_t max_heap = MaxHeapSize; |
61 max_heap -= Universe::get_heap_used_at_last_gc(); |
61 max_heap -= Universe::get_heap_used_at_last_gc(); |
62 max_heap /= M; |
62 max_heap /= M; |
63 |
63 |
64 _max_interval = max_heap * SoftRefLRUPolicyMSPerMB; |
64 _max_interval = max_heap * SoftRefLRUPolicyMSPerMB; |