getdelim: only grow buffer when necessary, improve OOM behavior