GeneralsGamePatch
GeneralsGamePatch copied to clipboard
The disabled binary shower particle effect causes a memory leak and eventual crash
The disabled binary shower particle effect causes a memory leak and eventual crash.

DisabledEffectBinaryShower0 is the "0" effect, which spawns a SlaveSystem of the DisabledEffectBinaryShower1 "1" effect as part of the overall disabled building / vehicle particle effect. Removing the SlaveSystem will solve the leak, but it doesn't look as good without the "1" effect and it does not solve the underlying issue. This particular leak is unlikely to come up during typical gameplay as it is so small and the abilities are uncommon, but it all adds up over time and it may be indicative of other memory issues (playing many games / watching many replays will gradually increase memory usage). There are 60 slave systems in ParticleSystem.ini.
ParticleSystem DisabledEffectBinaryShower0
SlaveSystem = DisabledEffectBinaryShower1
End
It should be noted that SpecialAbilityHackerDisableBuilding handles / overrides the SystemLifetime of its DisableFXParticleSystem via the EffectDuration field (which also controls how long the target is disabled), which may interfere with the slave system's lifetime. Particle system generation frequency is tied to how often the disabled condition is triggered on the target. Altering these values will affect gameplay.
Behavior = SpecialAbilityUpdate ModuleTag_05
PersistentPrepTime = 333 ; NOTE! This drives how often the disable effect gets triggered
; This is also how often a new particle system effect is spawned
EffectDuration = 2000
End
https://user-images.githubusercontent.com/11547761/219955698-e57d4a73-ebf3-49f7-b1d2-29286d922b4c.mp4
Note: Triggering either of the (Super) Hacker's Disable Building / Vehicle Hack abilities will also leak memory.
Note: Applying a high negative vertical drift velocity will result in the particle drifting into the ground and culling itself.
Perhaps this can be fixed by setting slave SystemLifetime = 70 to SystemLifetime = 0.
SystemLifetime essentially says how many copies it should create in the frames to come. On slaves it should be 0 in most cases.
The particles won't ever destroy if SystemLifetime = 0. Each instance of DisabledEffectBinaryShower0 will only create a single instance of DisabledEffectBinaryShower1.
Hmm. Perhaps try to set it to 1 then. Last time I checked missile effects, they looked to work fine and they also use slaves. For example MissileLenzflare is a slave.
ParticleSystem MissileLenzflare
Priority = WEAPON_TRAIL
IsOneShot = No
Shader = ADDITIVE
Type = PARTICLE
ParticleName = EXLnzFlar2.tga
AngleZ = 0.00 0.00
AngularRateZ = 0.00 0.00
AngularDamping = 1.00 1.00
VelocityDamping = 1.00 1.00
Gravity = 0.00
Lifetime = 2.00 2.00 ; Patch104p @tweak from 3.00 3.00 to match optimized color frames.
SystemLifetime = 0
Size = 180.00 240.00
StartSizeRate = 0.00 0.00
SizeRate = 0.20 0.20
SizeRateDamping = 1.00 1.00
Alpha1 = 1.00 1.00 0
Alpha2 = 0.00 0.00 2
Alpha3 = 0.00 0.00 0
Alpha4 = 0.00 0.00 0
Alpha5 = 0.00 0.00 0
Alpha6 = 0.00 0.00 0
Alpha7 = 0.00 0.00 0
Alpha8 = 0.00 0.00 0
Color1 = R:0 G:0 B:0 0
Color2 = R:255 G:255 B:255 1
Color3 = R:0 G:0 B:0 2 ; Patch104p @tweak from R:0 G:0 B:0 3 to show flare just for the duration of one frame.
Color4 = R:0 G:0 B:0 0
Color5 = R:0 G:0 B:0 0
Color6 = R:0 G:0 B:0 0
Color7 = R:0 G:0 B:0 0
Color8 = R:0 G:0 B:0 0
ColorScale = 0.00 0.00
BurstDelay = 0.00 0.00
BurstCount = 1.00 1.00
InitialDelay = 0.00 0.00
DriftVelocity = X:0.00 Y:0.00 Z:0.25
VelocityType = OUTWARD
VelOutward = 0.00 0.00
VelOutwardOther = 0.00 0.00
VolumeType = POINT
IsHollow = Yes
IsGroundAligned = No
IsEmitAboveGroundOnly = No
IsParticleUpTowardsEmitter = No
WindMotion = Unused
WindAngleChangeMin = 0.149924
WindAngleChangeMax = 0.449946
WindPingPongStartAngleMin = 0.000000
WindPingPongStartAngleMax = 0.785398
WindPingPongEndAngleMin = 5.497787
WindPingPongEndAngleMax = 6.283185
End
A few things to note:
DisabledEffectBinaryShower0'sSystemLifetimemust be at least 1 or the system will persist forever.DisabledEffectBinaryShower1'sSystemLifetimemust be at least 2 or it won't appear.
I think that is because BurstCount is 1.
EffectDuration = 2000 is 60 frames.
Perhaps try setting DisabledEffectBinaryShower0 SystemLifetime to 60 to match it.
Then set DisabledEffectBinaryShower1 SystemLifetime to 1 and BurstCount to 0.00 0.00.
Perhaps try setting
DisabledEffectBinaryShower0SystemLifetimeto 60 to match it.
Tried that and it doesn't help.
Then set
DisabledEffectBinaryShower1SystemLifetimeto 1 andBurstCountto 0.00 0.00.
The slave system's SystemLifetime must be at least 2 or it won't appear. The master system manages the slave's BurstCount, so changing this to 0.00 or any other value does nothing.
There are more things to test to try narrow down setup issue:
Does leak appear when replacing DisabledEffectBinaryShower1 with MissileLenzflare ?
Does leak appear when replacing DisabledEffectBinaryShower0 with MissileExhaust ?
If the answer is Yes to both, then there is certainly nothing we can do to fix it from INI.
I tried it with several other slave effects including those and the same issue occurs.
Appears to be fixed in Patch. Got this running for 5 minutes, process memory makes no significant jumps. Without Patch this is reproducible. No idea what could have fixed this.
Has been running for 1,5 hours in the background. Process memory just raised by 8 MB if I am not mistaken.