Correct Constructor for TString

I am trying to make a bunch of TString’s and they seem to be leaking memory. I’ve reduced the code the shortest possible amount and include it and compile options below.

I’m running on XP with 5.13/04 and Visual Studio 8. I’ve tested the same code under Linux and do not have any memory issues.

#include "TString.h"

int main()
{
  TString *ptr;

  for (Long_t i1=0; i1 < 100*1000*1000; i1++) 
    {
      ptr = new TString;
      delete ptr;
    }

  return 0;
}

and here’s my compile command

cl /O2 /nologo /EHsc c:/root/lib/libCore.lib c:/root/lib/libCint.lib main.cpp /link /OUT:main.exe

I see the memory leak on Windows Task Manger and it grows very quickly (100 Mbytes per second or so). If I run the same code with TObjString instead of TString there is no leak.

John Estrada