Hello,
I have created a C++ application, and a class named Loader, which should read 5000 text files. For every new file, I am reserving memory using the code like this:
item[fileIndex].fileText = new wchar_t[item[fileIndex].fileLength + 1];
and then read the text from the file to item[fileIndex].fileText.
After reading all the files, I am deleting the object of type Loader and creat it again. In the class destructor I am deleting all the item[...].fileText pointers.
The problem is that after reading another 5000 files one or more times, the application crashes, most of the time at the point where I am using the "new" operator mentioned above.
What do you think is the cause and how to solve it?
I have created a C++ application, and a class named Loader, which should read 5000 text files. For every new file, I am reserving memory using the code like this:
item[fileIndex].fileText = new wchar_t[item[fileIndex].fileLength + 1];
and then read the text from the file to item[fileIndex].fileText.
After reading all the files, I am deleting the object of type Loader and creat it again. In the class destructor I am deleting all the item[...].fileText pointers.
The problem is that after reading another 5000 files one or more times, the application crashes, most of the time at the point where I am using the "new" operator mentioned above.
What do you think is the cause and how to solve it?