result: s/maxcount/capacity/; s/count/size/
unify OOM handling in line_new and result_new