Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/metaspace.cpp @ 6734:942bb29b20b0
7196298: Better fix for 7195789
Reviewed-by: jcoomes, brutisso
author | jmasa |
---|---|
date | Thu, 06 Sep 2012 07:28:30 -0700 |
parents | 5d2156bcb78b |
children | 11fb740ce98f |
comparison
equal
deleted
inserted
replaced
6733:fa6e618671d7 | 6734:942bb29b20b0 |
---|---|
2539 #endif // PRODUCT | 2539 #endif // PRODUCT |
2540 | 2540 |
2541 | 2541 |
2542 // MetaspaceAux | 2542 // MetaspaceAux |
2543 | 2543 |
2544 size_t MetaspaceAux::used_in_bytes_unsafe(Metaspace::MetadataType mdtype) { | 2544 size_t MetaspaceAux::used_in_bytes(Metaspace::MetadataType mdtype) { |
2545 size_t used = 0; | 2545 size_t used = 0; |
2546 ClassLoaderDataGraphMetaspaceIterator iter; | 2546 ClassLoaderDataGraphMetaspaceIterator iter; |
2547 while (iter.repeat()) { | 2547 while (iter.repeat()) { |
2548 Metaspace* msp = iter.get_next(); | 2548 Metaspace* msp = iter.get_next(); |
2549 // Sum allocation_total for each metaspace | 2549 // Sum allocation_total for each metaspace |
2550 if (msp != NULL) { | 2550 if (msp != NULL) { |
2551 used += msp->used_words(mdtype); | 2551 used += msp->used_words(mdtype); |
2552 } | |
2553 } | |
2554 return used * BytesPerWord; | |
2555 } | |
2556 | |
2557 size_t MetaspaceAux::used_in_bytes(Metaspace::MetadataType mdtype) { | |
2558 assert(SafepointSynchronize::is_at_safepoint(), | |
2559 "Consistency checks require being at a safepoint"); | |
2560 size_t used = 0; | |
2561 #ifdef ASSERT | |
2562 size_t free = 0; | |
2563 size_t capacity = 0; | |
2564 #endif | |
2565 ClassLoaderDataGraphMetaspaceIterator iter; | |
2566 while (iter.repeat()) { | |
2567 Metaspace* msp = iter.get_next(); | |
2568 // Sum allocation_total for each metaspace | |
2569 if (msp != NULL) { | |
2570 used += msp->used_words(mdtype); | |
2571 #ifdef ASSERT | |
2572 free += msp->free_words(mdtype); | |
2573 capacity += msp->capacity_words(mdtype); | |
2574 assert(used + free == capacity, | |
2575 err_msg("Accounting is wrong used " SIZE_FORMAT | |
2576 " free " SIZE_FORMAT " capacity " SIZE_FORMAT, | |
2577 used, free, capacity)); | |
2578 #endif | |
2579 } | 2552 } |
2580 } | 2553 } |
2581 return used * BytesPerWord; | 2554 return used * BytesPerWord; |
2582 } | 2555 } |
2583 | 2556 |
2659 Metaspace::MetadataType nct = Metaspace::NonClassType; | 2632 Metaspace::MetadataType nct = Metaspace::NonClassType; |
2660 | 2633 |
2661 out->print_cr(" Metaspace total " | 2634 out->print_cr(" Metaspace total " |
2662 SIZE_FORMAT "K, used " SIZE_FORMAT "K," | 2635 SIZE_FORMAT "K, used " SIZE_FORMAT "K," |
2663 " reserved " SIZE_FORMAT "K", | 2636 " reserved " SIZE_FORMAT "K", |
2664 capacity_in_bytes()/K, used_in_bytes_unsafe()/K, reserved_in_bytes()/K); | 2637 capacity_in_bytes()/K, used_in_bytes()/K, reserved_in_bytes()/K); |
2665 out->print_cr(" data space " | 2638 out->print_cr(" data space " |
2666 SIZE_FORMAT "K, used " SIZE_FORMAT "K," | 2639 SIZE_FORMAT "K, used " SIZE_FORMAT "K," |
2667 " reserved " SIZE_FORMAT "K", | 2640 " reserved " SIZE_FORMAT "K", |
2668 capacity_in_bytes(nct)/K, used_in_bytes_unsafe(nct)/K, reserved_in_bytes(nct)/K); | 2641 capacity_in_bytes(nct)/K, used_in_bytes(nct)/K, reserved_in_bytes(nct)/K); |
2669 out->print_cr(" class space " | 2642 out->print_cr(" class space " |
2670 SIZE_FORMAT "K, used " SIZE_FORMAT "K," | 2643 SIZE_FORMAT "K, used " SIZE_FORMAT "K," |
2671 " reserved " SIZE_FORMAT "K", | 2644 " reserved " SIZE_FORMAT "K", |
2672 capacity_in_bytes(ct)/K, used_in_bytes_unsafe(ct)/K, reserved_in_bytes(ct)/K); | 2645 capacity_in_bytes(ct)/K, used_in_bytes(ct)/K, reserved_in_bytes(ct)/K); |
2673 } | 2646 } |
2674 | 2647 |
2675 // Print information for class space and data space separately. | 2648 // Print information for class space and data space separately. |
2676 // This is almost the same as above. | 2649 // This is almost the same as above. |
2677 void MetaspaceAux::print_on(outputStream* out, Metaspace::MetadataType mdtype) { | 2650 void MetaspaceAux::print_on(outputStream* out, Metaspace::MetadataType mdtype) { |