Delete multiple entites without loading them - running out of memory
Loading/deleting one at a time may use less memory:

use Drupal\node\Entity\Node;

$nids = [21,12,45,67];
foreach($nids as $nid)
{
  $node = Node::load($nid);
  $node-&gt;delete();
}


Each loop will overwrite the previous instance of $node, releasing the memory.