I dont think you should be using such using local variables for such a big memory space that you require. Better to do some memory allocation and write to it first before writing to the file.
Posted on 2006-07-07 08:34:09 by roticv
I dont think you should be using such using local variables for such a big memory space that you require. Better to do some memory allocation and write to it first before writing to the file.


In your own words:

Discussions based purely on opninions generally lead to flame wars, discussions based on experience can actually enlighten. But those based on a combination simply go nowhere. - E?in
  :lol: :lol:

Back on topic:
Can you tell me why?
IMO it would make the program slower if i first write to another buffer, and secondly, it will be part of a bigger program as well, so i prefer not to use a global variable here.
10kb can be pushed on the stack without any problems, unless the host program is already using a large ammount of memory on the stack.
Shredder doesn't do that, so i can't really see a good reason of doing so, but i could be wrong.

Posted on 2006-07-07 13:05:34 by white scorpion
Scorpion, with any local memory larger than ~4kb you have to "pretouch" the memory to avoid crashes, because of the guard-page way stack is allocated on windows. Then there's the issue of limited stack space per thread...

Thus, for anything larger than a "not too large" amount of kilobytes, I'd recommend temporary HEAP storage used instead. When dealing with file buffers, especially FILE_FLAG_NO_BUFFERING, VirtualAlloc is king since is guarantees you correct alignment.
Posted on 2006-07-07 14:34:36 by f0dder
This makes sense...
Will take a look at it asap.
Thanks for the explanation!
Posted on 2006-07-07 16:08:46 by white scorpion