I have this function that reproduces my problem:
(defn my-problem
[preprocess count print-freq]
(doseq [x (preprocess (range 0 count))]
(when (= 0 (mod x print-freq))
(println x))))
Everything works fine when I call it using the authentication function as follows:
(my-problem identity 10000000 200000)
;it prints 200000,400000 ... 9800000 just as it should
When I call it with seque , I get an OutOfMemoryError:
(my-problem
;it prints numbers up to 2000000 and then it throws OutOfMemoryException
I understand that the seque function should simply split the processing into two threads using a ConcurrentBlockingQueue with a maximum size of 5 (in this case). I do not understand where the memory leak occurs.
source
share