LZMA Memory Usage

2014-02-26
2016-03-07
  • Yeonjong Bong

    Yeonjong Bong - 2014-02-26

    Hello, I have some questions about LZMA.

    I found this comment below at LzmaLib.h.


    /
    RAM requirements for LZMA:
    for compression: (dictSize * 11.5 + 6 MB) + state_size
    for decompression: dictSize + state_size
    state_size = (4 + (1.5 << (lc + lp))) KB by default (lc=3, lp=0), state_size = 16 KB.
    LZMA properties (5 bytes) format
    Offset Size Description
    0 1 lc, lp and pb in encoded form.
    1 4 dictSize (little endian).
    /


    I am curious about how each compression/decompression memory usage formula comes.
    (especially a very big constant 6 MB for compression...)

    And is it possible to use very small memory(about 4KB) for compression/decompression?

    Thanks in advance.

     
    Last edit: Yeonjong Bong 2014-02-26
  • Igor Pavlov

    Igor Pavlov - 2014-02-26

    Most of additional 6 MB is used by multithreading (2-threads LZMA) code.
    LZMA can't work with 4 KB RAM.
    LZMA decoder probably can work with 8 KB of RAM in some mode.
    Current LZMA encoder code probably needs at least 1 MB of RAM.

     
    • Tiziano

      Tiziano - 2015-03-23

      When you say: "LZMA decoder probably can work with 8KB of RAM in some mode". Which mode do you refer? How could be this mode configured?

      Is it possible to disable the "Probs" buffers, in order to reduce RAM although I assume it will decrease speed?

       
      • Igor Pavlov

        Igor Pavlov - 2015-03-23

        You can use lc=0 (lc0) switch (when you create lzma file) to reduce state size.

         
        Last edit: Igor Pavlov 2015-03-23
  • Yeonjong Bong

    Yeonjong Bong - 2014-02-27

    Thank you very much.
    So, is using multithreading optional? I want to disable multithreading to reduce memory usage.
    If not, in order to disable multithreading, does it need lots of effort to revise code?

     
    • Igor Pavlov

      Igor Pavlov - 2014-02-27

      Yes, you can disable multithreading in options of LZMA encoder.

       
  • chfakht

    chfakht - 2016-03-07

    Please you said that Current LZMA encoder code probably needs at least 1 MB of RAM. Can you explain this more, how to reduce to use a minimum RAM for encoding it's not a problem if the encoding rakes more time

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks