Servers crashing after "not enough memory" bug

2 players sent me messages from the same server, saying their saved towns wouldn’t load or save. I joined, and the red server error was just “not enough memory”, verbatim. That caused a bug with Stravant’s EncodeInstance module, probably unrelated other than it creates instances from a string which could add to memory.
External Media

A couple minutes later, the server crashed. It said I lost connection and I tried to rejoin. It gave me Error ID = 17, and I asked the 2 guys I was with if they had the problem, and yep. Trying to join their dead server, it said “This game has ended” and the server disappeared from the list. Crashed, because I’m assuming it’s related to the “not enough memory” bug.

I haven’t seen this bug before today. Could Dinizter’s zombiecon server crashes be related to a memory bug? Documentation - Roblox Creator Hub

Edit: My friends were able to load their stuff on a different server (same version) but who knows when that server will “run out of memory”…

look for loops or recursions that call another function, or coroutine, and double check they aren’t spawning thousands of variables on the stack by re-running far too often, is the game mainly building or scripting? do you make common use of coroutines, or spawn()?

The game is both building + scripting, i.e. building towns brick by brick with tools

It just seems like the server has a set amount of memory and it crashes when it hits that limit. The game is a building game, and many people have big towns made of 10-15,000 bricks that they save and load. Loaded bricks are looped over with a for loop and properties are saved based on its name and children. Basic stuff. Lots of Destroying and Instancing and Cloning, like any game

What did you mean by re-running far too often?

Encoders,decoders,compilers,interpreters,… they all require a lot of memory.

You’re using an encoder, which is surely concatting the whole time strings.
Concatting “clones” the strings, sort of, thus a (temporary) waste of memory.
Imagine, a town of 10k-15k parts, encoding every part, and adding it to the total result…
Roblox servers don’t have infinite RAM, and yours, sir, yours did run out.

EDIT: Also, why not use CreatePlaceAsync() and SavePlace()/SavePlaceAsync() ?

CreatePlace divides the community. It’s a social game. Although, some people want private servers with their friends and createplace could help. Same with that upcoming thing in sorcus’s thread. I assume datastore will work for both, which is essential to load your town in the real game. Can someone confirm this o:

So… the solution to this encoder making the server run out of ram is to have a cooldown on the encoder itself? Like, if one person is saving or loading their town, another person can’t do it at the same time?

Well, we can’t tell that from just a ‘bug’ or error. If you can give us some statics, like is everthing saved using the encoder. And if so, what is the format that the Encoder gives, etc.

@Einstein.
Mind to fill me in ?

Exactly. We can’t tell what happened in a technical sense. The error was literally all lowercase and just “not enough memory”

This is the encoder, Stravant made it. http://www.roblox.com/EncodeInstance-Module-item?id=176696010 But the memory bug could be unrelated to it. I’m trying to use process of elimination to figure this out, when I shouldn’t have to. I’m currently testing einsteink’s theory where too many people using the encoder at once will make the server run out of available ram, so I’m making an “in_use” variable for it.

To answer your question about what the encoder does, it just converts instances into a compressed string, and can load them back again. DataStore saves and loads the string to persist through leaving and joining other servers. The string can be anywhere from 5 to 1,00,000 in length, which is no problem for DataStore splitting it up into sections of 60k (only 1-20 SetAsyncs)