Re: Using memory with futures

2017-09-08 Thread Max Muranov
> > You can probably also avoid the 60- to 80-second wait if you call > (shutdown-agents) at the end of your program. > My program is endless =) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegrou

Re: Using memory with futures

2017-09-07 Thread Andy Fingerhut
You can probably also avoid the 60- to 80-second wait if you call (shutdown-agents) at the end of your program. https://clojuredocs.org/clojure.core/future Andy On Thu, Sep 7, 2017 at 2:27 AM, Max Muranov wrote: > it takes about a minute for the pool to decide to shutdown the threads. >> > >

Re: Using memory with futures

2017-09-05 Thread Didier
Everything tbc++ said, But also, if you create futures at a faster rate then they terminate, you will eventually run out of memory, because futures are unbounded. If that's the case, you want to use ThreadPoolExecutor to create a bounded pool or a pool backed by a queue and then use it as expla

Re: Using memory with futures

2017-09-05 Thread Timothy Baldridge
Every thread created on the JVM takes about 2MB of memory. Multiply that by that number of threads, and I'm surprised your memory usage is that low. But the futures thread pool will also re-use previously created threads for new futures. In order to optimize this, a certain number of threads will b