Hi, this was brought to our attention on the Nim forum and I took a peek at why the Nim version was crashing.
Nim makes a copy of the primes array for each thread, which results in the oom crash, so for the Nim code to work on those large inputs, instead of passing primes to each worker thread, it’s enough to make that seq global. Pseudocode fix on that linked thread.
How does Crystal know it’s safe to pass the primes array by reference?
I do like how CRYSTAL_WORKERS works, that’s very handy. The equivalent for Nims threadpool is setMaxPoolSize