Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Operator "new" crashes application

Reply
Thread Tools

Operator "new" crashes application

 
 
pamir pamir is offline
Junior Member
Join Date: Feb 2011
Posts: 2
 
      02-17-2011
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?
 
Reply With Quote
 
 
 
 
pamir pamir is offline
Junior Member
Join Date: Feb 2011
Posts: 2
 
      02-17-2011
By the way, if I limit the number of files to 1000, crashes are much less, but generally the situation is the same.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
James Gosling the Creator of EMACS and JAVA - leaves ORACLE - Butthen reports started coming in of odd failures. Systems would crashstrangely. We'd get crashes in applications. All applications. Crashes in thekernel. small Pox C Programming 2 07-22-2010 10:07 PM
why delete operator crashes Nemo C++ 13 02-24-2006 04:07 PM
Why delete operator crashes Nemo C Programming 7 02-23-2006 10:25 PM
sun application server 8 crashes after its start immediately klops Java 0 05-14-2004 12:59 PM
ASP.NET application times out or crashes John Rebbeck ASP .Net 0 11-06-2003 06:43 AM



Advertisments