mercredi 24 février 2021

Access Violation Writing Location after Vector Resize? [closed]

I am bit confused on what could cause this.

Basically I have code doing this:

 std::vector<uint8_t> buffer;
 buffer.resize(size);
 memcpy(buffer.data(), data_, size);

Then after some amount time of this running I will get:

Access Violation Writing Location 0x000002484FC0B060

on the memcpy

The application has many threads going. I am fairly sure that buffer is not being touched by any other thread during this. But am curious, am I missing something here? Aside from some other thread touching buffer between the resize and memcpy, is there anyway the reference to buffer.data could end with write violation?

Aucun commentaire:

Enregistrer un commentaire