/**
 * Mimics C malloc somewhat, allocates an array of class instances of fixed size
 * @template T
 * @param {constructor<T>} Klass
 * @param {number} count
 * @returns {T[]}
 */
export function malloc(Klass, count) {
    const r = new Array(count);

    for (let i = 0; i < count; i++) {
        r[i] = new Klass();
    }

    return r;
}
