Allocate multiple buffers to fulfill the requested memory
toAllocate. We first divide
toAllocate in
chunks of size
maxChunk and try to allocate them in parallel on all available processors. If one chunk fails to be
allocated, we try to allocate two chunks of
maxChunk / 2. If this allocation fails, we continue dividing until
we reach of size of
minChunk. If at that moment, the allocation still fails, an
IllegalArgumentExceptionis thrown.
When
fixed is requested, we will only allocated buffers of
maxChunk size. If allocation fails, an
IllegalArgumentException is thrown without any division.
If the allocation is interrupted, the method will ignore it and continue allocation. It will then return with the
interrupt flag is set.