MPS issue job004083

TitleChainCreate calls ControlAlloc twice
Statusclosed
Prioritynice
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionChainCreate calls ControlAlloc once to allocate the array of GenDescStruct and another to allocate the ChainStruct. But this is unnecessary: since both sets of structures are required, they could be done in one allocation.

Other cases where there are multiple calls to ControlAlloc that could be combined are AWLSegInit and loSegInit. In TraceIdMessagesCreate there are two allocations but they are freed at separate points in time so although MVFF supports freeing memory with different sizes from allocation, we should make ControlFree match ControlAlloc to give us flexibility when replacing the control pool.

Allocating once would be quicker, and would avoid the need for unwind logic for the failure case, which tends to be hard to cover by test cases (job003482).
AnalysisPerhaps allocating more smaller objects makes it easier to pack them into memory? Seems unlikely.
How foundinspection
EvidenceNone
Created byGareth Rees
Created on2018-07-02 11:01:04
Last modified byGareth Rees
Last modified on2018-07-06 18:56:12
History2018-07-02 GDR Created.

Fixes

Change Effect Date User Description
194484 closed 2018-07-06 18:56:12 Gareth Rees Don't make multiple calls to ControlAlloc when you could just make one and divvy it up yourself.