microsoft / FASTER

Fast persistent recoverable log and key-value store + cache, in C# and C++.
https://aka.ms/FASTER
MIT License
6.29k stars 563 forks source link

Is it safe to reuse buffers between Upsert calls? #877

Closed AqlaSolutions closed 9 months ago

AqlaSolutions commented 11 months ago

I have a code like this:

// fields
private Memory<byte> _idBytes;
private Memory<byte> _data;

// method
_session.Upsert(ref _idBytes, ref _data);

Is it safe to modify and reuse buffers without waiting for previous Upsert to CompletePending?

badrishc commented 9 months ago

Yes, that is safe.