mercredi 25 octobre 2017

Resizing vector in child thread leads to unexpected memory consumption

I'm struggling with a (strange?) behavior when resizing vectors in subthreads.

The virtual memory consumption increases a lot when vector<T>.reserve is called in a subthread (or when a reallocation appends on adding elements) compared to the same code called in the main process.

I had a similar issue on vector.swap that can be solved thanks to std::swap.

In short, is there a way to safely resize a vector in a subthread, and what does cause such a behavior ?

I can put sample code if needed.

Thanks in advance ;)

Aucun commentaire:

Enregistrer un commentaire