Re: 7-zip reader issues (from "1.6.5 beta crashes")
Reply #1 – 2021-03-26 20:32:38
Topic split because this needs detailed explaining and may not be relevant to the crash issue from the original topic. 7-zip's solid mode requires extreme amounts of memory to unpack. This is problematic to satisfy in foobar2000's 32bit memory space. Even if required amounts of memory are available, it's impossible for 7-zip reader to allocate continuous memory blocks of the desired size. I originally made foobar2000 v1.6.5 7-zip reader take as much memory as it asks for. This was OK during normal operation, but turned extremely ugly when trying to convert files from an archive, using multiple threads. Not only it ran out of memory space, but caused random stuff to fail until foobar2000 restart, due to heap fragmentation issues. Think of 32bit address space as of a flat 4GB file, where continuous chunks are allocated for various operations, but the free space cannot be defragmented so after a certain chain of events you end with a state where every multi megabyte allocation request fails. For now I mitigated this by restricting the amount of memory that 7-zip reader is allowed to take, which unfortunately causes some files to fail reading. Proper solution is to go 64-bit (and break all existing plug-ins) or read 7-zip out-of-process (slower, creates temporary files). I don't currently want to go either way (even though 64-bit is inevitable eventually), foobar2000 is a music player, not an archiver. I might revise this logic, maybe block concurrent extraction of 7-zips, but there's basically no good solution to this.