How to use the library in thread-safe mode wrote:This library exists in two versions :
- the standard version, located in %Purebasic%\PureLibraries\UserLibraries\ ;
- the thread-safe version, located in %Purebasic%\SubSystems\UserLibThreadSafe\PureLibraries\ .
In order to use this library in thread-safe mode (compiler option /THREAD), you have to enable the subsystem 'UserLibThreadSafe' in the PB IDE, or add '/SUBSYSTEM UserLibThreadSafe' to the PBCompiler arguments. In jaPBe, do nothing : it will automatically enable the 'UserLibThreadSafe' subsystem to use the threadsafe versions of the installed userlibraries.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
I am using the miniUNZIP example supplied with your library to expand a 188MB zip containing one 900MB file. Memory usage goes up well beyond the 1/2 GB mark when unzipping using the compiled exe!! Why is memory usage so high? Surely the unzipped "chunks" are written straight to the destination HDD and not to memory. Any ideas?
I am using the miniUNZIP example supplied with your library to expand a 188MB zip containing one 900MB file. Memory usage goes up well beyond the 1/2 GB mark when unzipping using the compiled exe!! Why is memory usage so high? Surely the unzipped "chunks" are written straight to the destination HDD and not to memory. Any ideas?
Yes, during decompression, PureZIP does one AllocateMemory(FileSize) and so does ZLIB's unzReadCurrentFile() ; the extracted file is written from memory to disk with WriteData(). I will see if I can change this, e.g. only allocate a small buffer and decompressing with a loop.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
webbmeister wrote:Thanks Gnozal, that would be a great help. Also, I am having zipping/ unzipping files that have 0KB size - ie a text file with no content.
webbmeister wrote:That seems a lot more memory friendly.
Thanks. Please test it well (all three extraction functions PureZIP_Archive_Extract()/PureZIP_ExtractFile()/PureZIP_ExtractFiles()) because some critical code has changed.
webbmeister wrote:Is there a simple way of checking that a zip has written correctly and is not corrupt?
A suggestion :
You can get the CRC32 for each file in the ZIP
webbmeister wrote:It struggles with the following zip file...
.DS_STORE.ZIP
containing...
.DS_STORE
I get "No Files Extracted". Other than that, perfect!!!
Changes
- decompression is more memory friendly
- some fixes for zero length files
- fixed wildcard problem
- PB4.0x version : added thread-safe lib (see help how to use it)
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
Changes
- Renamed function PureZIP_SetCallback() to PureZIP_SetProgressionCallback()
- Added function PureZIP_SetCompressionCallback()
PureZIP_SetProgressionCallback() wrote:Set PureZIP progression callback address for the functions :
- PureZIP_ExtractFiles()
- PureZIP_AddFiles() The callback is called each time a new file is processed.
Usefull to indicate the progress when many files are packed / unpacked.
PureZIP_SetCompressionCallback() wrote:Set PureZIP (de)compression callback address for the functions :
- PureZIP_Archive_Compress()
- PureZIP_Archive_Extract()
- PureZIP_ExtractFile()
- PureZIP_AddFile()
- PureZIP_ExtractFiles()
- PureZIP_AddFiles() The callback is called in realtime during compression or decompression.
Usefull to indicate the progress when a big file is packed / unpacked.
See the new MiniZIP/MiniUNZIP sources for an example using both callbacks.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).