<div dir="ltr"><div dir="ltr">On Fri, Jan 15, 2021 at 8:00 AM dog2002 via Digitalmars-d-learn <<a href="mailto:digitalmars-d-learn@puremagic.com">digitalmars-d-learn@puremagic.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Friday, 15 January 2021 at 06:33:55 UTC, Paul Backus wrote:<br>
> On Friday, 15 January 2021 at 06:31:18 UTC, Paul Backus wrote:<br>
>><br>
>> You can save a little bit of memory here by allocating <br>
>> tempBuffer on the stack:<br>
>><br>
>>     ubyte[512] tempBuffer;<br>
>>     _inputFile.rawRead(tempBuffer[]); // note the explicit []<br>
><br>
> I made a mistake; this should be:<br>
><br>
>     ubyte[512] tempArray;<br>
>     ubyte[] tempBuffer = _inputFile.rawRead(tempArray[]);<br>
><br>
> ...with the rest the same as your original version.<br>
<br>
Thank you so much! It saves a lot of memory!<br>
<br>
And one last question: why the application crashes, if I allocate <br>
1 MB array?<br>
<br>
>ubyte[1024000] tempBuffer;<br></blockquote><div><br></div><div>Because of stack overflow </div></div></div>