allocPtr
Allocates one or more pointers as a single chunk of memory and zeroes them out.
The first argument is the number of pointers to allocate. The second specifies whether they should use a "safe" pointer size (8 bytes) or whether they may use the default pointer size (typically 4 but also possibly 8).
How the result is returned depends on its first argument: if passed 1, it returns the allocated memory address. If passed more than one then an array of pointer addresses is returned, which can optionally be used with "destructuring assignment" like this:
const [p1, p2, p3] = allocPtr(3);ACHTUNG: when freeing the memory, pass only the first result value to dealloc(). The others are part of the same memory chunk and must not be freed separately.
The reason for the 2nd argument is...
When one of the returned pointers will refer to a 64-bit value, e.g. a double or int64, and that value must be written or fetched, e.g. using poke() or peek(), it is important that the pointer in question be aligned to an 8-byte boundary or else it will not be fetched or written properly and will corrupt or read neighboring memory. It is only safe to pass false when the client code is certain that it will only get/fetch 4-byte values (or smaller).