From 800ae5f55a2aaa96c39073c02a53626c94eebf6d Mon Sep 17 00:00:00 2001 From: Jerry Peng Date: Tue, 4 Dec 2012 09:55:53 +0800 Subject: [PATCH] Use `into {}` instead of `apply hash-map` For huge maps, `apply` may cause OOM, because it will realize all the elements of the arglist seq, and construct an Object[] to hold them. --- src/taoensso/nippy.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/taoensso/nippy.clj b/src/taoensso/nippy.clj index 0eb8706..7581a10 100644 --- a/src/taoensso/nippy.clj +++ b/src/taoensso/nippy.clj @@ -193,7 +193,7 @@ id-list (apply list (coll-thaw! s)) id-vector (into [] (coll-thaw! s)) id-set (into #{} (coll-thaw! s)) - id-map (apply hash-map (coll-thaw! s)) + id-map (into {} (map vec (partition 2 (coll-thaw! s)))) id-coll (doall (coll-thaw! s)) id-queue (into (PersistentQueue/EMPTY) (coll-thaw! s))