Avoid 'Cannot allocate memory' errors