search

Home  >  Q&A  >  body text

c++ - 程序运行中止,求原因

MaplesGraph::MaplesGraph(size_t size) : size(size), graph(size) {
    this->weights = new double *[size];
    for (size_t i = 0; i < size; ++i) {
        this->weights[i] = new double[size];
        for (size_t j = 0; j < size; ++j) {
            this->weights[i][j] = -1.0;
        }
    }
}

size 为24702, 大概分到11300左右就会中止。是因为分的内存太大的原因吗?

迷茫迷茫2803 days ago529

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 13:18:23

    Yes. 24702 24702 8 is about 4G memory. It can be run after compiling it to 64-bit.

    reply
    0
  • Cancelreply