Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/allocation.hpp @ 9088:89e4d67fdd2a
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 12 Apr 2013 14:05:42 +0200 |
parents | b8f261ba79c6 83f27710f5f7 |
children | 43223d3f5dcd |
comparison
equal
deleted
inserted
replaced
9037:b008f40b67d0 | 9088:89e4d67fdd2a |
---|---|
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 |