converter: use heap for buffer allocation instead of stack