Here’s a snippet that will create an unreasonable amount of folders parented in a chain:
local timeout = os.clock() + 1/60
local a = workspace
for i = 8192, 1, -1 do
local b = Instance.new("Folder")
b.Name = i
b.Parent = a
a = b
if os.clock() > timeout then -- Prevent freezing
print("Progress", i)
game:GetService("RunService").Heartbeat:Wait()
timeout = os.clock() + 1/60
end
end
print("Done")
I was deciding if I should design something so I iterate through objects in a parent chain like that so I came up with that command to test the limitations. The idea is that FindFirstChild needs to search through every child, but the search scales a lot better if it’s daisy chained like that. Anways, it doesn’t always crash the first time, but entering the command multiple times always causes a crash for me.
Game servers handle it incredibly well in comparison:
I’ve also had it happen when deleting one of the folder groups.
This is a bit random, but a crash is a crash. I can send the memory dump if needed.
If anyone’s curious, I’m trying to get around the StringValue.Value data size limitation of 199999 bytes in a way that works with ChangeHistoryService.
My first design was like this, but multiple instances had to be parented to nil when the string’s length is shortened:
With this chained design, I just need to parent the first extra child to nil when the string’s length is shortened. Plus FindFirstChild is a tiny bit faster and there’s no need to convert numbers to strings. I could also add other numbered children to the value if needed. It’s just a simpler implementation overall:
I’m a little bit afraid of how DescendantAdded needs to be updated for the entire chain, so I’m still not sure. Nearly all of my chunks of data will be well under 200000 bytes, but I don’t want to get hit with confusing errors randomly in the future.