Re: Using crypto++ to gunzip a file into memory



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

.



Relevant Pages

  • Re: call by address vs. call by value
    ... Why is a bolt better than a nail? ... Call by value means that the contents of a piece of memory is passed ... Could be an integer, a floating point number, a whole 10 kb string. ... need to work on the original data, or on/with a copy of it. ...
    (comp.lang.c)
  • Re: "Move memory" in no time
    ... place in memory. ... original data any more. ... So far I call memcpy and free up the original ... the space used by that pointer. ...
    (comp.os.linux.development.apps)
  • Re: "Move memory" in no time
    ... For API compatibility, I need to move a large block of data to another ... place in memory. ... original data any more. ... the space used by that pointer. ...
    (comp.os.linux.development.apps)
  • Re: "Move memory" in no time
    ... place in memory. ... original data any more. ... it needs something at a particular memory location. ... I would suggest writing a driver. ...
    (comp.os.linux.development.apps)
  • Memory usage of Managed Objects
    ... get the memory size of these objects. ... Marshal Managed objects. ... some other way to get memory sizes of cached objects ...
    (microsoft.public.inetserver.asp.general)