Dharani Dharan
Dharani Dharan

Reputation: 644

Memory allocation while zlib-compressing data?

Go:

Assume, there are 10 threads running in parallel to compress the 100 MB of data each. For each and every thread going to compress 100 MB of data. I am using zlib compression to compress the data.

Consider one process took nearly 2 sec to compress the 100 MB of data. So What happens if all the threads running parallel to compress the data.

And also i need clarification about Memory allocation for each thread.

Case 1: having 1 GB RAM memory, Now the 10 threads going to run parallel to start the compression means , Whether it will take all the RAM Memory for the process of compression?

 10 Threads * 100 MB = 1000 (Approx)

Upvotes: 0

Views: 1031

Answers (1)

Glenn Randers-Pehrson
Glenn Randers-Pehrson

Reputation: 12465

zlib itself will need a relatively trivial amount of memory, up to 256kb per thread. This will be dominated by the memory you use to store your input and output, if you are keeping those in memory. For details, see the zlib web site (Look for the "Memory Footprint" topic).

Upvotes: 3

Related Questions