If user's account isn't limited with ulimit
then it will take as much memory as needed from free physical RAM (even if you limit it with ulimit
it is still have ability to use virtual memory).
The problem will happened if your program trying to fill out RAM with generated characters. At some point you will fill all available RAM and your process will start swapping to virtual memory (or basically to a file) that slow down the whole PC since OS need some breath too and swapping back and forth will kill performance of the whole machine.
Correct approach for such tasks is to allocate a small buffer in memory ( say 4-8 Mb) and periodically dumping buffer (in append mode) to a file. This would be fastest solution in your case without putting operation system to knee.
might be better suited for for software engineering or similar site
– Albin – 2018-11-17T20:28:23.080Did you run out of memory when running the process? – Aulis Ronkainen – 2018-11-17T20:44:46.360
Aulis ronkainen no I didn’t. Just wanna make this go faster. I have a limited time. I’m creating a dictionary that’s generating every letter and number. For example aa ab... aA aB... A1 A2... – Harry qwerty – 2018-11-17T20:50:23.090
4@Harryqwerty RAM is dynamically allocated based on process's usage. It the process isn't being allocated much memory, it's likely that it simply isn't using much memory, and adding more to it won't speed it up (it'd just have lots of unused memory lying around). – Gordon Davisson – 2018-11-17T21:13:35.647
@GordonDavisson, thank you! That's exactly what I was going for. – Aulis Ronkainen – 2018-11-18T12:05:13.300