Reducing buffer size to avoid memory errors