std.zip expand: memory allocation failed

Steven Schveighoffer schveiguy at gmail.com
Tue Oct 26 13:43:36 UTC 2021


On 10/26/21 2:32 AM, bauss wrote:
> On Monday, 25 October 2021 at 22:38:38 UTC, Imperatorn wrote:
>> On Monday, 25 October 2021 at 20:50:40 UTC, Steven Schveighoffer wrote:
>>> On 10/24/21 8:00 AM, Selim Ozel wrote:
>>>
>>>> It turns out my computer was literally running out of memory as the 
>>>> file was getting unzipped. For some reason  to uncompress a 1-gig 
>>>> file with uncompressed size of 4-gig, Zip Archive of D-Lang tries to 
>>>> use more than 16 gig of RAM. I don't know why. Maybe I missed 
>>>> something. I use a Windows 10, DMD v2.091 with x86_mscoff.
>>>
>>> Wait, x86 is 32-bit. Max address space is 4GB. So maybe it was just 
>>> trying to use 4GB and running out of memory?
>>>
>>> -Steve
>>
>> Good catch, but still, should it use so much memory?
> 
> Definitely not. It shouldn't use a lot of memory when unzipping as it 
> should be done in chunks!

You guys aren't getting it:

```
ubyte[] expand(ArchiveMember de);
Decompress the contents of a member.
Fills in properties extractVersion, flags, compressionMethod, time, 
crc32, compressedSize, expandedSize, expandedData[], name[], extra[].
```

Where is it supposed to store that `ubyte[]`?

-Steve


More information about the Digitalmars-d-learn mailing list