How can I detect high memory spikes / a new gui added to prevent dex?

Genuinely curious, How can I like detect if the memory spikes to aronud 10k and maybe a new CoreGui / GUI

Not sure about memory, but for Gui you can do

player.PlayerGui.DescendantAdded:Connect()