Hi. I was reading https://dragan.rocks/articles/18/Neanderthal-vs-ND4J-vol2 and saw this example. Is this use of with-release actually memory safe? e.g., if the mapping function threw part way through the list its looping over, will it safely dispose of the already looped over values? e.g., [m1, m2, ex!!!] - will m1 and m2 be released?
(defn bench-neanderthal-mm [dimensions]
(with-release [ms (map (comp (partial fmap! random) fge)
(butlast dimensions) (rest dimensions))]
(quick-bench
(release (apply mm ms)))))It should release nested sequences, too.
What about the case of an exception while looping over the list?
Please throw that exception, check whether your data has been released, and, if there's a bug, open an issue.