checks to prevent OOM