Avoiding out of memory exceptions.