Lets say you have a byte array, of 1 million items (1 mega byte)
this array will be used to store incoming data from network, and data keep coming in. when enough data arrived, will get processed, but the data will still maintain in the array, just pointer will be moved(indicating where new data should append to and until where it has been processed)
I wonder if there is a way of keep using this 1 mega byte buffer, without moving and manually truncate them.
ie currently reaching the very end of the buffer, at 999,000 bytes i can use another 1k bytes only before i hit out of bound error, are there anyway to lets say dispose the 900k bytes at the front then move them to the end ? i know u can copy whatever relevant to the front then keep using the same buffer, but the indexing will be a bit confusing and copy and move data during that moment will cause slight delay, beside moving those data, any alternative ?
how to avoid moving data, c#
Mar 16 2024, 01:30 AM, updated 2y ago
Quote
0.0157sec
0.25
6 queries
GZIP Disabled