add OutOfMemoryError detection