extend API for zero copy to minimize memory allocation