3434. ios_base never reclaims memory for iarray and parray

Section: 31.5.2.8 [ios.base.cons] Status: C++23 Submitter: Alisdair Meredith Opened: 2020-04-26 Last modified: 2023-11-22

Priority: Not Prioritized

View all other issues in [ios.base.cons].

View all issues with C++23 status.

Discussion:

According to 31.5.2.6 [ios.base.storage] the class ios_base allocates memory, represented by two exposition-only pointers, iarray and parray in response to calls to iword and pword. However, the specification for the destructor in 31.5.2.8 [ios.base.cons] says nothing about reclaiming any allocated memory.

[2020-07-17; Reflector prioritization]

Set priority to 0 and status to Tentatively Ready after six votes in favour during reflector discussions.

[2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP.]

Proposed resolution:

This wording is relative to N4861.

  1. Modify 31.5.2.8 [ios.base.cons] as indicated:

    [Drafting note: Wording modeled on container requirements]

    ~ios_base();
    

    -2- Effects: Calls each registered callback pair (fn, idx) (31.5.2.7 [ios.base.callback]) as (*fn)(erase_event, *this, idx) at such time that any ios_base member function called from within fn has well-defined results. Then, any memory obtained is deallocated.