Velocity Reviews

Velocity Reviews (
-   C++ (
-   -   Operator "new" crashes application (

pamir 02-17-2011 02:07 PM

Operator "new" crashes application

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?

pamir 02-17-2011 03:59 PM

By the way, if I limit the number of files to 1000, crashes are much less, but generally the situation is the same.

All times are GMT. The time now is 01:29 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.