What is the maximum number of scoreboard objectives (1.15.2 / 1.16)?

I think and hope the answer is there is no limit because I'm building a really advanced PvE map and I will rage quit if I'm almost done and I can't add the last scoreboard! I have probably over 40 scoreboard objectives right now, and I will probably add at least 40 more!

So if there is a limit, what is the limit (and do I have to worry about hitting it)?


I have not tried this, but I would assume the limit to be the limit of an ArrayList, because Minecraft loads the scoreboards into a list when reading the NBT file scoreboards.dat. I assume this is an ArrayList, because that's the most common type of list.
The specific behaviour of growing an ArrayList (and therefore the exact limit) depends on the Java version, but in most modern versions your limit should be:

1 485 738 814

So don't worry about running out any time soon.
My test world has a scoreboard.dat file that occupies 2058 bytes and I have 69 scoreboards, most of them holding only one or a few entries. So an optimistic guess would be that when you have enough scoreboards to crash your game, the scoreboard.dat file would be over 41 GB big. Most computers don't even have enough RAM to load that file into it, so you would get an OutOfMemoryError way before. With the default launcher profile this would happen at around 36 000 000 scoreboards (or a lot earlier, because other things also need RAM). But I would guess that the game should definitely be able to deal with one million scoreboards just fine, even on a weak computer.