Document memory allocation functions