Clojure store persistent data structures gotcha – load-file size limit
2012-10-15 Hinterlasse einen Kommentar
In clojure – the data structure and their default representation are suited as readable and portable format to persist data. But there is a small pitfall in using it.
Data Structure example:
{ :request-time 2636, :status 200, :headers { "server" "Server", "content-encoding" "gzip", } }
Be aware that this function is intended to load code only. If your data structures or a string in them grow bigger than around 65,535 it crashes.
Exception similar to:
java.lang.ClassFormatError: Unknown constant tag 49 in class file parse$eval13
Please use read-string instead.
Example: (read-string (slurp "data.clj"))
Source: Rich Hickey on google groups Google Groups