[SERVER-12714] Eliminate uses of realloc/malloc/free in C++ code Created: 13/Feb/14 Updated: 05/Dec/23 Resolved: 05/Dec/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Andy Schwerin | Assignee: | Backlog - Service Architecture |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Service Arch
|
||||||||||||||||
| Sprint: | Execution Team 2022-12-12, Execution Team 2022-12-26, Execution Team 2023-01-09 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
The allocators we use don't have advantageous realloc behavior, and using malloc/free in C++ code prevents us from letting the "new handler" abort on allocation failures. That, in turn, leads us to a highly suspect set of macros in allocator.h, that may cause ODR violations or other surprising behaviors. The solution is to replace uses of malloc with new, free with delete and realloc with new, memcpy and delete, if they can't be eliminated outright. |
| Comments |
| Comment by Steven Vannelli [ 04/Dec/23 ] |
|
Sending this to Service Arch to evaluate the benefit of this will be as they own the allocator. |