Uploaded image for project: 'Mesos'
  1. Mesos
  2. MESOS-3741

stout containers inherit from STL containers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • stout
    • None

    Description

      stout exposes a number of containers (hashmap, hashset, list, multihashmap, and set) which publicly inherit from their STL counterparts since MESOS-3217. This code being in stout means these custom containers live in the global namespace.

      Classes inherited publicly from STL containers are not generally safe to use as the STL containers lack virtual destructors, so that deleting through a ptr-to-base will not invoke the base dtr and leak memory. It appears this is being made worse by e.g. putting the stout containers (which are often named like their STL counterparts) in the global namespace which makes it easy to confuse the actual type being used (at least in messy user code containing using namespace std; which is not allowed for good reasons like this in mesos code).

      It would seem better to (1) decide what minimal set of containers still needs to be provided now that C++11 can be used, (2) fix the inheritance for the stout containers (e.g. inherit privately or just compose), or at least (3) use a dedicated namespace for these custom containers.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bbannier Benjamin Bannier
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: