Array concatenation vs. Appender

Era Scarecrow rtcvb32 at yahoo.com
Sat Feb 2 17:53:43 PST 2013


On Sunday, 3 February 2013 at 01:41:26 UTC, Jonathan M Davis 
wrote:
> reserve should guarantee that you have at least the requested 
> amount of memory already allocated, or it's broken. Its whole 
> purpose is to guarantee that capacity is at least as large as 
> the amount being reserved so that you can do a single 
> allocation up front rather than having to worry about 
> reallocations occurring as you append.

  Allocated, set aside, uninterrupted continuous block, etc. As 
long as the space is actually available when it's needed it's 
implemented doesn't matter. In the end it's up to the OS.

  The OS could be using Virtual Memory space by compressing data, 
then decompressing when it's requested/needed; In that case the 
data pre-allocated is empty (zeroed) it can compress instantly to 
almost nothing (Compressed swapfile driver in Linux for example). 
The most important part is making sure nothing else can claim any 
memory in the reserved block.


More information about the Digitalmars-d-learn mailing list