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(); |
|
30 } |
|
31 |
|
32 // Capture state (of-the-VM) information needed to evaluate the policy |
|
33 void LRUCurrentHeapPolicy::snap() { |
29 _max_interval = (Universe::get_heap_free_at_last_gc() / M) * SoftRefLRUPolicyMSPerMB; |
34 _max_interval = (Universe::get_heap_free_at_last_gc() / M) * SoftRefLRUPolicyMSPerMB; |
30 assert(_max_interval >= 0,"Sanity check"); |
35 assert(_max_interval >= 0,"Sanity check"); |
31 } |
36 } |
32 |
37 |
33 // The oop passed in is the SoftReference object, and not |
38 // The oop passed in is the SoftReference object, and not |
45 } |
50 } |
46 |
51 |
47 /////////////////////// MaxHeap ////////////////////// |
52 /////////////////////// MaxHeap ////////////////////// |
48 |
53 |
49 LRUMaxHeapPolicy::LRUMaxHeapPolicy() { |
54 LRUMaxHeapPolicy::LRUMaxHeapPolicy() { |
|
55 snap(); |
|
56 } |
|
57 |
|
58 // Capture state (of-the-VM) information needed to evaluate the policy |
|
59 void LRUMaxHeapPolicy::snap() { |
50 size_t max_heap = MaxHeapSize; |
60 size_t max_heap = MaxHeapSize; |
51 max_heap -= Universe::get_heap_used_at_last_gc(); |
61 max_heap -= Universe::get_heap_used_at_last_gc(); |
52 max_heap /= M; |
62 max_heap /= M; |
53 |
63 |
54 _max_interval = max_heap * SoftRefLRUPolicyMSPerMB; |
64 _max_interval = max_heap * SoftRefLRUPolicyMSPerMB; |