clean up used memory
properly size buffer when point count is large #123