raiguard / Krastorio2

An overhaul mod for Factorio focusing on end-game technologies and moderately increased complexity.
https://mods.factorio.com/mod/Krastorio2
GNU Lesser General Public License v3.0
116 stars 49 forks source link

Anti Biter Virus Capsule leads to OOM error #379

Open Blackclaws opened 9 months ago

Blackclaws commented 9 months ago

Description

Having a large surface that is full of biters (such as a radius 9000 world with threat level 100% in Space Exploration) and throwing the Virus capsule will lead to out of memory errors (slowly but steadily using up to 64 Gb of memory and then crashing due to OOM).

The random function also completely tanks performance when the entity count becomes large. Stepping with a random modulus might be faster.

Reproduction

  1. I can't attach the save game easily as its 1 Gb in size.
  2. Get a large enough surface with a ton of threat
  3. Scan it completely
  4. Throw the virus capsule
raiguard commented 8 months ago

Yeah... this is a problem. I'll have to rewrite this logic to not build a list of every creep tile on the surface before clearing them. I did that in order to remove them in a nice, random pattern, but I can do something like iterate chunks in a spiral pattern outward from where the virus is thrown.