7197666: java -d64 -version core dumps in a box with lots of memory

Allow task queues to be mmapped instead of malloced on Solaris

Reviewed-by: coleenp, jmasa, johnc, tschatzl
This commit is contained in:
Bengt Rutisson 2013-04-08 07:49:28 +02:00
parent fabb8c6e25
commit 4a685f181b
4 changed files with 72 additions and 3 deletions

View file

@ -611,4 +611,23 @@ public:
void check() PRODUCT_RETURN;
};
// Helper class to allocate arrays that may become large.
// Uses the OS malloc for allocations smaller than ArrayAllocatorMallocLimit
// and uses mapped memory for larger allocations.
// Most OS mallocs do something similar but Solaris malloc does not revert
// to mapped memory for large allocations. By default ArrayAllocatorMallocLimit
// is set so that we always use malloc except for Solaris where we set the
// limit to get mapped memory.
template <class E, MEMFLAGS F>
class ArrayAllocator : StackObj {
char* _addr;
bool _use_malloc;
size_t _size;
public:
ArrayAllocator() : _addr(NULL), _use_malloc(false), _size(0) { }
~ArrayAllocator() { free(); }
E* allocate(size_t length);
void free();
};
#endif // SHARE_VM_MEMORY_ALLOCATION_HPP