Ответ
moko 09.12.2022 08:40
/ 09.12.2022 08:41
Не совсем корректно искать утечки разовыми замерами, надо делать цикл. И если сделать вот такой цикл:
@handle[data]
$result[]
$data[^for[](0;10000){a}]
^for[n](1;100){
^memory:compact[]
$console:line[${n}: ^stat[$status:memory]]
$void[^work[]]
}
#end @handle[]
То видно, что все в порядке (потребление памяти стабилизировалось около какой-то величины). При этом присвоение $result[] в первой строке и $void внутри цикла существенны, без этого будет накопление результата работы метода/цикла до его завершения.
80: used: 1168, free: 1208, ever_allocated_since_compact: 0, ever_allocated_since_start: 158982.65625
81: used: 1180, free: 1196, ever_allocated_since_compact: 0.578125, ever_allocated_since_start: 160989.828125
82: used: 1172, free: 1204, ever_allocated_since_compact: 0, ever_allocated_since_start: 162995.859375
83: used: 1172, free: 1204, ever_allocated_since_compact: 0.578125, ever_allocated_since_start: 165005.8125
84: used: 1172, free: 1204, ever_allocated_since_compact: 0.578125, ever_allocated_since_start: 167012.390625
85: used: 1160, free: 1216, ever_allocated_since_compact: 0, ever_allocated_since_start: 169018.421875
86: used: 1160, free: 1216, ever_allocated_since_compact: 0.578125, ever_allocated_since_start: 171025.65625
87: used: 1180, free: 1196, ever_allocated_since_compact: 0.578125, ever_allocated_since_start: 173032.21875
88: used: 1160, free: 1216, ever_allocated_since_compact: 0, ever_allocated_since_start: 175038.25
89: used: 1180, free: 1196, ever_allocated_since_compact: 0.578125, ever_allocated_since_start: 177045.453125
90: used: 1196, free: 1180, ever_allocated_since_compact: 0, ever_allocated_since_start: 179051.453125
91: used: 1212, free: 1164, ever_allocated_since_compact: 0, ever_allocated_since_start: 181059.953125
92: used: 1184, free: 1192, ever_allocated_since_compact: 0.578125, ever_allocated_since_start: 183067.125
93: used: 1184, free: 1192, ever_allocated_since_compact: 0, ever_allocated_since_start: 185073.15625
94: used: 1196, free: 1180, ever_allocated_since_compact: 2.140625, ever_allocated_since_start: 187081.953125
95: used: 1184, free: 1192, ever_allocated_since_compact: 2.140625, ever_allocated_since_start: 189088.53125
96: used: 1184, free: 1192, ever_allocated_since_compact: 1.5625, ever_allocated_since_start: 191094.5625
97: used: 1176, free: 1200, ever_allocated_since_compact: 2.140625, ever_allocated_since_start: 193101.796875
98: used: 1176, free: 1200, ever_allocated_since_compact: 2.140625, ever_allocated_since_start: 195108.359375
99: used: 1172, free: 1204, ever_allocated_since_compact: 1.5625, ever_allocated_since_start: 197114.390625
100: used: 1204, free: 1172, ever_allocated_since_compact: 2.140625, ever_allocated_since_start: 199121.59375