Let’s say I would like to compress the following list and keep the compressed version in RAM:
List = lists:seq(1,100000).
The example provided in the official documentation doesn’t work for me – I get the error for unbound variable Read and I do not understand what it is used for (is it a function or a variable?).
I have tried to search on the web, but the only thing that I have found is related to decompressing files.
So, the question is: How can I compress the list List and decompress it back with the help of zlib in Erlang? How can I see what amount of memory is consumed by the List and its compressed counterpart?
You can compress the data in the following manner:
To decompress the data you can do:
You can just figure out the size by checking CData.