[SERVER-68824] Coverity analysis defect 123333: Inefficient vector resizing with reserve. Created: 15/Aug/22 Updated: 05/Dec/22 Resolved: 17/Aug/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Coverity Collector User | Assignee: | Backlog - Query Execution |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | coverity | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Execution
|
| Operating System: | ALL |
| Participants: |
| Description |
|
Inefficient vector resizing with reserve. This operation, if performed to grow large vectors, may take a very long time to complete. A vector's capacity is increased with reserve in a manner that causes many unnecessary copies. |
| Comments |
| Comment by Kyle Suarez [ 17/Aug/22 ] |
|
This call to std::vector::reserve() is not the inefficient variety because the final size is known a priori and so the memory reservation is done at most once. |