News for hackers. Stuff that matters.
Re:A Database Without Dynamic Memory Allocation by colejohnson66 on Thursday October 13, 2022 @01:39PM (#33194167)
IIRC, .NET does something similar for OutOfMemoryExceptions. The exception is thrown before actually running out of memory. That allows just enough space for the OutOfMemoryException object (and associated exception info) to be allocated.
Re:A Database Without Dynamic Memory Allocation by znpy on Thursday October 13, 2022 @03:14PM (#33195230)
Iirc also perl does this. I’m on the phone right now, but iirc $^O was a variable filled with about 20k of worthless data that could be freed in case of an out of memory condition.
Re:A Database Without Dynamic Memory Allocation by gloria_mundi on Friday October 14, 2022 @08:39AM (#33202723)
It's called $^M, and you have to explicitly fill it with garbage.
Re:A Database Without Dynamic Memory Allocation by Merad on Thursday October 13, 2022 @04:14PM (#33195944)
I believe the runtime preallocates an OOME on startup, so if one is encountered it can just fill in the blanks and throw without needing any additional allocations.