taoensso / nippy

The fastest serialization library for Clojure
https://www.taoensso.com/nippy
Eclipse Public License 1.0
1.04k stars 60 forks source link

Use `into {}` instead of `apply hash-map` #3

Closed jerrypnz closed 11 years ago

jerrypnz commented 11 years ago

I use nippy in production and found an OOM issue caused by the deserialization of a huge map, after monitoring the application for a while, I found it is caused by nippy.

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.

I changed this line and use (into {} ...) instead of (apply hash-map ...), and it works. The OOM issue could be avoided by this.

ptaoussanis commented 11 years ago

Hi Jerry,

Thanks for the heads-up! I've made some changes for performance and have just pushed 1.0.1-SNAPSHOT to Clojars and the dev branch: https://github.com/ptaoussanis/nippy/commit/c2c46167ec664a89b83521f8f9a17a066fc31eb7.

Please take a look and let me know if that solves the issue?

Cheers!

ptaoussanis commented 11 years ago

1.0.1 pushed to Clojars & master.