What is the fastest way to initialize a buffer with zeros? I need a buffer which is 1/8 filled with data and 7/8 with zeros. The data is a copy from another buffer. The buffers can be several 100MB big and I have to do this quite often. My current solution is to allocate a buffer eight times the size of the source buffer, copy the data from the source and initialize the rest with zeros. But if there is e.g. a way to initialize the whole buffer at the same time with zeros, I can save some write operations.