gosieve icon indicating copy to clipboard operation
gosieve copied to clipboard

Added Memory Clean-up

Open jgleesawn opened this issue 10 years ago • 1 comments

Added a cascading memory clean-up effect based on panics caused by writing to closed channels. Usage: primes := Sieve() close(primes) This allows you to create multiple fast prime-number generators without suffering from massive memory problems.
Thanks for writing this in the first place.

jgleesawn avatar Jul 13 '14 09:07 jgleesawn

sorry for late response, for some reason I didn't see this coming thru my email.

I wrote this as a toy example to play with goroutines and didn't quite envision this to be used in production, mainly due to the fact that it spawns a lot of goroutines. I'm sure there are better ways to generate prime faster with lower memory usage!

aht avatar Aug 08 '14 23:08 aht