3 ms·
Static array. If you wish, it was allocated for you by the JVM, when it started your program. My point is that it wasn't allocated from a call to new(), and i
by AnimalMuppet 5y ago
Static array. If you wish, it was allocated for you by the JVM, when it started your program. My point is that it wasn't allocated from a call to new(), and if someone calls your function, you don't have to call new() to give them a block.
This is in fact an allocator, in the same sense that a C++ arena allocator is an allocator, and in the same sense that malloc is an allocator, and in the same sense that the OS's memory manager is an allocator. They're doing the same things - they're managing a block of memory, and returning sub-blocks of it when requested.