Memory segment #1 has exceeded 100 KB length limit



  • About 10 times a day I see an error like Memory segment #1 has exceeded 100 KB length limit

    The penultimate statement in my main.loop is console.log("debug segment lengths:", _.map(RawMemory.segments, (s) => s ? s.length : 0));

    So just before I get this error, my debug statement logs that segments 0-8 all have a length of 102400 characters. So they are exactly at the 100KB length limit.

    2018-08-15 19:31:49 shard2: debug segment lengths: 102400,102400,102400,102400,102400,102400,102400,102400,102400

    Error:shard2: Memory segment #1 has exceeded 100 KB length limit

    So every tick I'm storing several segments containing 102400 characters of data, but a few times a day I get this error that the data was actually longer than 102400 characters (even though I just logged the segment length!)

    I've recently started storing wider string data in my segments - that is, I'm using some unicode characters that are beyond ASCII. Is it possible that the memory segment - after the game serialises it into the database at the end of the tick, then unserialises it at the beginning of the following tick - ends up expanding to a new string that isn't identical to the previous string and is longer than 102400 characters?



  • A further note - in the tick that gets the Error about a segment exceeding length limit, nothing else gets logged other than that statement. Does this mean that my code ran that tick, but all logging was thrown away when the memory segment limit was exceeded, or does it mean that my code didn't run at all that tick?



  • OK FWIW I was able to prove that my code was running on the tick where the error triggered, and I was exceeding the memory limit. But sadly the log lines don't get output when this happens.

    Is there any chance we can output the console logging on the tick when this size error gets triggered, rather than hiding it?