There's another simple explanation for spurious "out of memory" errors.
Sloppy amateur coders make system and library calls and don't check for errors at all. When something goes wrong their code crashes.
Professional programmers check for errors all the time and do their best to give meaningful diagnostics.
Sloppy amateur coders who are vaguely aware of the concept of error checking but too lazy to do it properly will check for errors, and if they detect any error at all, regardless of whether it's running out of memory or something else completely different, will print an "out of memory" message because, well, perhaps it is actually out of memory, and anyway it's very boring to write all the proper code to work out what really happened.
Such things really happen. I've seen the code. On a really bad day because I'm being paid to rewrite it properly.