@bplus I too ran your new code with everything shut down, except for terminal and htop on my Linux.
I get the same 65,478 number.
I also noticed just now you are running a 32-bit machine, where both of mine are 64-bit machines.
When I ran it from my Linux terminal, I get a message "Segmentation fault (core dumped)" error message, which does not show up when running from the IDE. I checked the run on my MAC OSX, and it gets a similar error message.
This is a memory error - more specifically, the program is trying to access memory that doesn't belong to it. I have 32GB of RAM on my Linux Optiplex computer, where my MACBook Pro only has 8GB of RAM. What is the RAM on your PC?
However, it seems that this memory is also affected by the OS/Kernel running, and yes, other processes. Unless you are actively running memory intensive processes, stopping applications will not have an effect on your results. What usually happens is that most all processes are swapped out when an active program is running, freeing up memory. Also, having SWAP memory available will effect your results. In Linux, I have vm.swappiness set to 60, which means it will grab memory from the SWAP file before RAM is exhausted.
Now having said that, on my Linux system, your program maxes out two of my four-core CPU's. Running a monitoring program, it seems that I get this error when one of my CPU's hits 103% utilization. However, my RAM usage never exceeds 5%. I also verified this using the htop utility as well. So while I get a Segmentation Fault error, I am wondering if this is also displayed when I exceed my CPU utilization? It should only be based on the amount of memory available to the program, or the memory the OS/Kernel allocates to it.