converted some global_alloc_array() usage to dynamic_buffer/dynamic_array (nw)