Lisp - write to file using low memory footprint

前端 未结 2 687
再見小時候
再見小時候 2021-01-25 01:19

I have large hash tables that I am writing to disk as an occasional backup. I am finding that as I map the hash tables and write to a file, the RAM usage skyrockets compared to

2条回答
  •  无人及你
    2021-01-25 02:06

    Try loop to loop over the hash-tables.

    sth like:

    (loop for k1 
          being the hash-key 
          using (hash-value v1) of (customer-var1 cust-data)
          do (format s "~A ~A~%" k1 v1))
    

    Or if you don't need the values:

    (loop for k being the hash-key of (customer-var2 cust-data)
          do (format ))
    

    Originally I thought maphash would collect values but it does not, as @tfb pointed out. Then I don't know.

提交回复
热议问题