equal
deleted
inserted
replaced
609 public: |
609 public: |
610 ReallocMark() PRODUCT_RETURN; |
610 ReallocMark() PRODUCT_RETURN; |
611 void check() PRODUCT_RETURN; |
611 void check() PRODUCT_RETURN; |
612 }; |
612 }; |
613 |
613 |
|
614 // Helper class to allocate arrays that may become large. |
|
615 // Uses the OS malloc for allocations smaller than ArrayAllocatorMallocLimit |
|
616 // and uses mapped memory for larger allocations. |
|
617 // Most OS mallocs do something similar but Solaris malloc does not revert |
|
618 // to mapped memory for large allocations. By default ArrayAllocatorMallocLimit |
|
619 // is set so that we always use malloc except for Solaris where we set the |
|
620 // limit to get mapped memory. |
|
621 template <class E, MEMFLAGS F> |
|
622 class ArrayAllocator : StackObj { |
|
623 char* _addr; |
|
624 bool _use_malloc; |
|
625 size_t _size; |
|
626 public: |
|
627 ArrayAllocator() : _addr(NULL), _use_malloc(false), _size(0) { } |
|
628 ~ArrayAllocator() { free(); } |
|
629 E* allocate(size_t length); |
|
630 void free(); |
|
631 }; |
|
632 |
614 #endif // SHARE_VM_MEMORY_ALLOCATION_HPP |
633 #endif // SHARE_VM_MEMORY_ALLOCATION_HPP |