IBM Support

PI16187: MEMORY LEAK DUE TO REMAINING TEMPORARY CONSTRUCTOR

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The resulting exe from the test case below is leaking memory
    because a temporary constructor created is not being deleted
    properly.
    
    ===== COMPILE COMMAND:
    xlC test.cpp
    
    $ cat test.cpp
    #include <cassert>
    #include <iostream>
    using namespace std;
    
    
    int ctor = 0;
    
    
    struct mystring{
       mystring(){ copy = false; ctor++; cout << "default ctor" <<
    endl; }
       mystring(const mystring& con){ ctor++; cout << "copy ctor" <<
    endl;
              copy = true; }
       ?mystring(){ ctor--; cout << "dtor copy=" << copy << endl; }
       int at(int a) { return 1; }
    
    
      bool copy;
    };
    
    
    mystring convertString( const char *string )
    {
       mystring result;
       return result;
    }
    
    
    void test()
    {
       mystring( convertString("test") ).at(0); // NOK
    // mystring ms( convertString("test") );    // OK
    // int x = ms.at(0);
    }
    
    
    int main(void)
    {
       test();
       assert(ctor==0);
       return 0;
    }
    $
    
    ===== ACTUAL OUTPUT:
    $./a.out
    default ctor
    copy ctor
    dtor copy=0
    Assertion failed: ctor==0, file: ./test.cpp, line: 33
    CEE5207E The signal SIGABRT was received.
    [1] + Done(131) ./a.out
      67110483      Abort   ./a.out
    $
    
    ===== EXPECTED OUTPUT:
    The assert should not be triggered.
    

Local fix

  • N/A
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED: z/OS v1r13 users.                            *
    ****************************************************************
    * PROBLEM DESCRIPTION: Destruction of a temporary was missing  *
    *                      which caused memory leak.               *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    

Problem conclusion

  • Apply provided service.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI16187

  • Reported component name

    C/C++ FOR MVS

  • Reported component ID

    56551210A

  • Reported release

    780

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2014-04-17

  • Closed date

    2014-05-21

  • Last modified date

    2016-09-13

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Modules/Macros

  • CCNEIPAO CCNEIPA3 CCNQIPA
    

Fix information

  • Fixed component name

    C/C++ FOR MVS

  • Fixed component ID

    56551210A

Applicable component levels

  • R780 PSY UI18232

       UP14/06/26 P F406

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M","label":"APARs - z\/OS environment"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"780","Edition":"","Line of Business":{"code":"","label":""}},{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSQKCWV","label":"IBM C\/C++ for MVS\/ESA"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"780","Edition":"","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Document Information

Modified date:
15 August 2024