dongshi1102
2016-02-02 11:43
浏览 219
已采纳

zlib压缩数据时的内存分配?

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)

图片转代码服务由CSDN问答提供 功能建议

开始:

假设 10个并行运行的线程分别压缩100 MB数据。 对于每个要压缩100 MB数据的线程。 我正在使用zlib压缩来压缩数据。

考虑到一个过程花了将近2秒钟来压缩100 MB数据。 因此,如果所有并行运行的线程都可以压缩数据,将会发生什么情况。

而且我还需要澄清每个线程的内存分配。

案例1: 有1 GB RAM内存,现在10个线程将并行运行以启动压缩方式,是否需要占用所有RAM内存进行压缩? \ n

  10个线程* 100 MB = 1000(大约)
   
 
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doulai1910 2016-02-02 16:06
    已采纳

    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).

    打赏 评论

相关推荐 更多相似问题