                         doc-key     (get-doc-key json-key doc) 
                         _           (log/debug (str "doc-key: " doc-key))
                         riak-key    (Location. riak-bucket doc-key)
-                        riak-value  (BinaryValue/create 
-                                      ;; mem leak?
-                                      (json/write-str doc :escape-unicode false))
-                                      ;; mem leak ?
+                        json-byte   (.getBytes (ches/generate-string doc))
+                        riak-value  (BinaryValue/unsafeCreate json-byte)
                         start       (. System (nanoTime))
                         ; check if this returns an error
                         _           (log/debug (str riak-client riak-bucket riak-key "riak-value"))
+                        ;returns {:ok ...} || {:err ...} could be checked
                         _           (riak-store! riak-client riak-bucket riak-key riak-value)
                         exec-time   (with-precision 3 
                                       (/ (- (. System (nanoTime)) start) 1000000.0)) ]

;; limitations under the License.

(ns ^{  :doc "Loading data into Riak"
        :author "Istvan Szukacs"}
  riak-loader.core
  (:require 
    [clojure.java.io        :as   io    ]


        (thread
          (Thread/sleep 100)
          (doseq [json-doc json-hmps]
            (blocking-producer work-chan json-doc)))

        ;; end of sending thread
