Calling `debug.profilebegin` too many times without a matching `debug.profileend` crashes the application if microprofiler is enabled

In studio, create a script with:

for i = 1, 100000 do
    debug.profilebegin('oops')
end

Make sure microprofiler is enabled (without it enabled it does not crash) and run the simulation → Studio crashes.

If there is a matching profileend call, no crash occurs:

for i = 1, 100000 do
    debug.profilebegin('oops')
    debug.profileend()
end

I don’t know when this started happening. I have only tested this issue in the current Studio version and assume this also occurs in the online client. OS: Win10.

Not really sure what behavior to expect here (maybe an error when too many profilebegins are nested?), but anything is better than an entire application crash I suppose.

1 Like

I think you’re pushing a system to the extremes, and its definitely not meant to be pushed to its extremes

2 Likes