Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/os.cpp @ 20630:787c9c28311f
8058251: assert(_count > 0) failed: Negative counter when running runtime/NMT/MallocTrackingVerify.java
Summary: Fixed an issue when overflowing the MallocSite hash table bucket
Reviewed-by: coleenp, gtriantafill
author | ctornqvi |
---|---|
date | Tue, 11 Nov 2014 10:48:06 -0800 |
parents | ed3d653e4012 |
children | 7848fc12602b 340ca8812af9 |
comparison
equal
deleted
inserted
replaced
20629:09259e52a610 | 20630:787c9c28311f |
---|---|
569 | 569 |
570 void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) { | 570 void* os::malloc(size_t size, MEMFLAGS memflags, const NativeCallStack& stack) { |
571 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1)); | 571 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1)); |
572 NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size)); | 572 NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size)); |
573 | 573 |
574 #if INCLUDE_NMT | |
575 // NMT can not track malloc allocation size > MAX_MALLOC_SIZE, which is | |
576 // (1GB - 1) on 32-bit system. It is not an issue on 64-bit system, where | |
577 // MAX_MALLOC_SIZE = ((1 << 62) - 1). | |
578 // VM code does not have such large malloc allocation. However, it can come | |
579 // Unsafe call. | |
580 if (MemTracker::tracking_level() >= NMT_summary && size > MAX_MALLOC_SIZE) { | |
581 return NULL; | |
582 } | |
583 #endif | |
584 | |
585 #ifdef ASSERT | 574 #ifdef ASSERT |
586 // checking for the WatcherThread and crash_protection first | 575 // checking for the WatcherThread and crash_protection first |
587 // since os::malloc can be called when the libjvm.{dll,so} is | 576 // since os::malloc can be called when the libjvm.{dll,so} is |
588 // first loaded and we don't have a thread yet. | 577 // first loaded and we don't have a thread yet. |
589 // try to find the thread after we see that the watcher thread | 578 // try to find the thread after we see that the watcher thread |
650 void* os::realloc(void *memblock, size_t size, MEMFLAGS flags) { | 639 void* os::realloc(void *memblock, size_t size, MEMFLAGS flags) { |
651 return os::realloc(memblock, size, flags, CALLER_PC); | 640 return os::realloc(memblock, size, flags, CALLER_PC); |
652 } | 641 } |
653 | 642 |
654 void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCallStack& stack) { | 643 void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCallStack& stack) { |
655 #if INCLUDE_NMT | |
656 // See comments in os::malloc() above | |
657 if (MemTracker::tracking_level() >= NMT_summary && size > MAX_MALLOC_SIZE) { | |
658 return NULL; | |
659 } | |
660 #endif | |
661 | 644 |
662 #ifndef ASSERT | 645 #ifndef ASSERT |
663 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1)); | 646 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1)); |
664 NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size)); | 647 NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size)); |
665 // NMT support | 648 // NMT support |