Forum Discussion

sechrest's avatar
15 years ago

No class names for objects created using operator new[]

I'm using the allocation profiler and hit a snag.  I switched the container for one of my most allocated class from an stl vector to a standard array created with operator new[].  After doing so, the class name no longer shows any memory allocations in the results panel (either objects or classes).  Instead, it's lumped in with C++ native memory and is therefore nearly impossible to track.  What's even more odd is that if I allocate a single object it is tracked.  For example:



CMyClass* pArray = new CMyClass[1000]; // not tracked

CMyClass* pOne = new CMyClass; // works fine!



Any ideas?

  • Hi Michael,





    We failed to reproduce this behavior with AQtime 6.50. Here is the code of a sample application I used:



    #include "stdafx.h"

    #include "windows.h"





    class CTest

    {

    private:

      BYTE data[32768];





    public:

      void FillData() {data[0] = 0x00;}

      CTest() {};

    };





    int _tmain(int argc, _TCHAR* argv[])

    {

      CTest*  pArray = new CTest[256];

      CTest* myObj = new CTest();





      pArray[0].FillData();

      return 0;

    }






    Please let me know whether you can reproduce the problem with this sample. If you cannot, could you please send me your sample demonstrating the problem? You can send it directly via the Contact Support form.