Code: Select all
data.raw["electric-pole"]["medium-electric-pole"].supply_area_distance = 64;
Repro steps:
1. Load the provided game with the provided mod in vanilla 2.0.28
2. Hover mouse over the combinator in the center of screen, and press R many times (on Windows 11 with 32GB or RAM, at least 20 times).
3. If the memory leak is triggered, then memory usage will start to grow with each press of R. E.g., 2GB->3.5GB->5GB->9GB->12GB->18GB. Each press will take longer to process before game execution resumes.
Info:
The combinator being rotated is powered by 4 separated power poles all drawing power from the same electric energy interface. I'm sure the memory leak is in the "which electric network am I powered by now?" code. It is also highly dependent on the exact configuration of poles and networks. Using fewer poles or poles in different locations, or just moving the poles around can cause the leak to no longer trigger.
It's also clearly in the ephemeral game state. Rotating 15 times, saving the game, and loading it again resets the effect and another 20 rotations are needed before memory-leak-induced lag happens again.