In my project, friezes and lags begin over time. By and large, I thought that the number of animations from the mobs was to blame. But recently, it starts to freeze at much earlier stages. At the same time, there were no algorithms for the appearance of mobs or a change in their behavior.
For some reason, it occurred to me to check how Debris () behaves.
Then I just created a project that constantly generates primitives destroyed through Debris.
Russian
В моём проекте, с течением времени начинаются фризы и лаги. По большому счёту я думал что виновато количество анимаций от мобов. Но в последнее время фризить начинает и на гораздо более ранних этапах. При этом алгоритмов появления мобов или изменение их поведения не производил.
Почему-то мне пришла в голову мысль проверить как ведёт себя Debris().
Тогда я просто создал проект, который постоянно генерирует примитивы уничтожающиеся через Debris.

Script1

Scrip2

The expected result is up to a certain number (i.e., until the first start of Debris ()), memory usage should increase, and then fluctuate in one limit.
But what a strange picture I saw:
Russian
Ожидаемый результат - до определённого числа (т.е. до перого старта Debris()) использование памяти должно расти, а потом колебаться в одном пределе.
Но вот какую странную картинку я увидел:
Result
But this is not the strangest. The strangest thing is that the effect of floating slow motion was manifested!
Russian
Но это не самое странное. Самое странное что проявился эффект плавающего слоу-моушен!
Then I added a timer self-destruct script to the primitive and included it in the generator instead of using Debris ().
It is expected that memory consumption has increased - each primitive has a script attached. But at the same time, the memory consumption behaved predictably and the effect of slow motion was absent !!!
Russian
Тогда я добавил в примитив скрипт самоуничтожения по таймеру и включал его в генераторе вместо использования Debris().
Ожидаемо, умеличилось потребление памяти - у каждого примитива привязан скрипт. Но при этом, и расход памяти вел себя предсказуемого и эффекта слоу-моушен отсутствовал!!!
change script generation:


destruction script:

Thus, my primary assumption is that the number of animations to blame has faded into the background. The primary was - not the correct operation of the Debris () garbage collection service.
Output. Now you have to replace the use of Debris () everywhere with the addition of a self-destruct script.
Russian
Таким образом, моё первичное предположение что виновато количество анимаций ушло на второй план. Первичным стало - не корректная работа службы уборки мусора Debris().
Вывод. Теперь придётся везде заменить использование Debris() на добавление скрипта самоуничтожения.
Debris-poor.rbxl (18.4 KB)
