Follow Us
Contribute
  • Register
Errorbase is a collaborative writing project, that aims to build the largest trouble-shooting guide about all kinds of error messages.

Categories

0 votes
  1. This is one of the most common error massages for C++. It is usually appeared when Standard Template Libraries are used such as vectors and lists. Especially vectors consume a lot of memory, which may be the cause of this error message.
  2. Another cause is wrong implementation of arrays. Don't be surprised if you have a bug on line 10, and you encounter the error message on line 20. This is a very common thing to happen in C++.
requested by (170k points)
edited by

1 Solution

0 votes

This error is hard to solve and it may appear in many cases, so improve the article by adding as many cases as possible.

  1. The solution for this problem is specific to each implementation, but there are some common mistakes to avoid. For example, the elements of a vector must be filled with the pointers, not the objects themselves. Detailed solution manual about this error message will be given later.
  2. Avoid exceeding arrays. Don't do this:

     int *x;
     int a = 0,b = 0,c =0;
     x = new int[1];
     x[0] = a;
     x[1] = b;
     x[2] = c;

This code works, but if you continue to allocate memory, you may encounter this error message in the future.
 

solved by (170k points)
edited by
...