简体   繁体   中英

libarchive: how to force flush into disc? or set memory usage limit?

I try to use libarchive to create some archives. I use directly an example from wiki . Problem is that it stores everything in memory until archive_write_free is called. Simple measurement: adding about 2000000 x 1.5KB of random ascii buffers (as 7zip) stores ~350MB in memory, without single write into disc. I tried archive_write_open callback-version and write callback was never called until archive_write_free . Do you know any way to force libarchive to flush data in progress? or set some memory limit? or how to measure in runtime how much it allocated (I could close it, rotate file, and open new one)?

PS. I tried libarchive 3.2.2 from official Ubuntu 18.4 bundle and 3.6.1 from repo, both the same results.

It seems that it is a bug/feature of archive_write_set_format_7zip . When gzip or xz filter used then data are dumped frequently into disc as expected. I have reported an issue , maybe I will get more info there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM