0
Follow
0
View

mutil_thread append string cause core

dlw_19880201 注册会员
2023-01-25 16:51

You are potentially changing the capacity of the vector after you already started some threads.

The easiest way to prevent the vector from re-allocating and moving its contents is to reserve the amount of space before you start the first worker thread.

So call

gTestVec.reserve(NUM);

Before your loop.

About the Author

Question Info

Publish Time
2023-01-25 16:51
Update Time
2023-01-25 16:51