Re: Using crypto++ to gunzip a file into memory
- From: "Mark Adler" <madler@xxxxxxxxxxxxxxxxxx>
- Date: 26 Aug 2005 08:39:30 -0700
aslanski2002@xxxxxxxxx wrote:
> The last four bytes are the size of the original data.
Only if you happen to know using some other means that the uncompressed
data is less than 4 GB. If you don't know that, then those four bytes
are the size modulo 2^32.
By the way, I am perplexed by the apparently frequent desire to load an
entire file into memory. The traditional way to process a file is a
chunk at a time. For large enough chunks, this does not reduce speed
for sequential access, and uses much less memory. If you want random
access then you should be using a virtual memory system (e.g. with
mmap) or something similar to page in frequently used portions and read
in only what you need. Reading an entire file into memory will waste
memory resources unless you know a priori that you are dealing with
very small files. Even though memory sizes of machines are large, file
sizes can be quite a bit larger, as has been the case since the
beginning of mass storage.
mark
.
- Follow-Ups:
- Re: Using crypto++ to gunzip a file into memory
- From: saragwyn
- Re: Using crypto++ to gunzip a file into memory
- From: saragwyn
- Re: Using crypto++ to gunzip a file into memory
- References:
- Using crypto++ to gunzip a file into memory
- From: saragwyn
- Re: Using crypto++ to gunzip a file into memory
- From: aslanski2002
- Using crypto++ to gunzip a file into memory
- Prev by Date: Re: Using crypto++ to gunzip a file into memory
- Next by Date: Re: Using crypto++ to gunzip a file into memory
- Previous by thread: Re: Using crypto++ to gunzip a file into memory
- Next by thread: Re: Using crypto++ to gunzip a file into memory
- Index(es):
Relevant Pages
|