Fixing the memory requirements of the elastic optimization