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

Avoid use names malloc, realloc and free in API so MSVC's _CRTDBG_MAP_MALLOC is possible

    XMLWordPrintable

Details

    • Windows
    • 43108bc6fa76e46c402cbfca7c05d14b977d3060 (qt/qtbase/dev)

    Description

      In contrast to other platforms on Windows it's not possible to activate valgrind. A great solution for MSVC would be to just use the CRT-Library with 

      #define _CRTDBG_MAP_ALLOC
      #include <stdlib.h>
      #include <crtdbg.h>
      

      Unfortunately that doesn't compile. The reason is, that with CRT-Library uses #define to replace malloc, realloc, and free by their debug-version; but the Qt sources contain methods whose names coincide with these standard library functions in some places: 

      • In QList's QListData has a realloc method. It's private and undocumented: all references are in your hands. It's just a minor refactoring.
      • In QVarLengthArray first: it's just a private method. No problem to refactor this also.
      • In QVarLengthArray second: it's a template seems to be used internally and undocumented. May be reachable from outside.
      • New since 5.14 there is a method realloc in QVector.

      Can't these usages just be renamed to remove the problems?

      (Remark: I know there's another ticket to this topic but it's from 2014 and down-voted in priority – no one looks at it. This case is way more substantial than that ticket reflects!)

      Attachments

        Issue Links

          Activity

            People

              jazzco Jesko von Monkiewitsch
              jazzco Jesko von Monkiewitsch
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: