When an entity is damaged, a CombatEntry is created in CombatTracker.entries.
Every second the CombatTracker.entries will be cleared if the entity is dead or wasn’t damaged during the last 100 ticks (300 ticks if entity was recently attacked).
The problem: If an entity takes damage frequently with less than 100 ticks between the damages, new entries are added to the list and the list won't be cleared, causing a memory leak
I was unable to reproduce this with the following setup:
Create a new void superflat world
/fill -2 -59 -2 2 -59 2 lime_stained_glass
/teleport @s 0 -58 0
/gamerule commandBlockOutput false
Build the following on the glass, where the repeaters are all set to 4 (redstone) ticks and the command block has
execute positioned 0 -61 0 as @e[type=sheep] run damage @s 0 minecraft:mob_attack by @e[type=minecraft:armor_stand,limit=1,sort=random]
/fill -31 -61 -31 31 -61 31 stone_brick_wall
/fill -30 -61 -30 30 -61 30 air
/fill -30 -62 -30 30 -62 30 minecraft:dispenser[facing=up]{Items:[{id:"sheep_spawn_egg",components:{"minecraft:entity_data":{id:"minecraft:sheep",NoAI:1b}}}]}
/fill -30 -63 -30 30 -63 30 minecraft:redstone_block
/summon minecraft:armor_stand -31 -59 0
/summon minecraft:armor_stand 31 -59 0
/summon minecraft:armor_stand 0 -59 -31
/summon minecraft:armor_stand 0 -59 31
Your setup will now look like this:
Press the button
Observe memory usage in F3 menu or system software
Enabling AI on the sheep and increasing the number of sheep affected did not help.
Please provide reproduction steps that demonstrate a meaningful memory impact caused by this issue. This report will be automatically reopened when you reply.