perhaps, xmalloc should be used here and lower (and xcalloc instead of calloc), cause it ensures it not returns NULL - it could trigger GC and raises a fatal exception if could not allocate memory even after that.