Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-115222

Clean up memory management in auto test – QtDeclarative edition

    XMLWordPrintable

Details

    • d496f8c79 (dev), e61da05b1 (dev), 427047314 (dev), 50548cd9d (dev), 7e8dbc0fc (dev), 1065fdd04 (dev), cd24a13ae (dev), 0529361a9 (dev), 057b143fd (dev), 92c774594 (dev), ce4460198 (dev), aba9359de (dev), 1c34d3e81 (dev), f3b881a0c (dev), 74a4b2789 (dev)

    Description

      Quite a few of our tests are using raw new and delete – or even only new without delete.
      This is bad, as a failing test might not reach the delete call, and consequently leak memory (or in the case of missing delete, unconditionally leak memory).

      While it doesn't really hurt the test itself it it leaks memory, it makes it impossible to rely on ASAN to catch memory leaks in the framework code itself while running the test suite.

      There are a few common patterns:

      Solve this by making sure that owned pointers are always stored in a std::unique_ptr, and replace calls to delete with calls to std::unique_ptr::reset (unless the unique pointer is no longer used afterwards).

      Attachments

        For Gerrit Dashboard: QTBUG-115222
        # Subject Branch Project Status CR V

        Activity

          People

            amanda.hamblin-true Amanda Hamblin-True (Inactive)
            fabiankosmale Fabian Kosmale
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are 5 open Gerrit changes