From b507ce88baa34f8dc6d6dbf08328e033dc407262 Mon Sep 17 00:00:00 2001 From: Lennart Haller Date: Thu, 25 Jul 2019 17:47:06 +0200 Subject: [PATCH] Fix a seqfault which occured when loading large maps --- orb_slam2/src/System.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/orb_slam2/src/System.cc b/orb_slam2/src/System.cc index 1eb30a5f..16df710f 100644 --- a/orb_slam2/src/System.cc +++ b/orb_slam2/src/System.cc @@ -614,6 +614,13 @@ bool System::LoadMap(const string &filename) { return false; } + const rlim_t kNewStackSize = 64L * 1024L * 1024L; // min stack size = 64 Mb + const rlim_t kDefaultCallStackSize = GetCurrentCallStackSize(); + if (!SetCallStackSize(kNewStackSize)) { + std::cerr << "Error changing the call stack size; Aborting" << std::endl; + return false; + } + std::cout << "Loading map file: " << map_file << std::flush; boost::archive::binary_iarchive ia(in, boost::archive::no_header); ia >> mpMap; @@ -638,6 +645,8 @@ bool System::LoadMap(const string &filename) { std::cout << " ... done" << std::endl; in.close(); + + SetCallStackSize(kDefaultCallStackSize); return true; }