From a0c09c8f46ae665ec9c03178742f8e2f32f92af2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 11 Jul 2016 14:08:19 +0200 Subject: Support valgrind directly in the buildsystem --- common/storage_lmdb.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index 79f4465..91d2443 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "log.h" @@ -621,11 +622,16 @@ Storage::Private::Private(const QString &s, const QString &n, AccessMode m) : st mdb_env_close(env); env = 0; } else { - // FIXME: dynamic resize - // In order to run valgrind this size must be smaller than half your available RAM - // https://github.com/BVLC/caffe/issues/2404 - const size_t dbSize = (size_t)10485760 * (size_t)8000; // 1MB * 8000 - mdb_env_set_mapsize(env, dbSize); + if (RUNNING_ON_VALGRIND) { + // In order to run valgrind this size must be smaller than half your available RAM + // https://github.com/BVLC/caffe/issues/2404 + const size_t dbSize = (size_t)10485760 * (size_t)1000; // 1MB * 1000 + mdb_env_set_mapsize(env, dbSize); + } else { + // FIXME: dynamic resize + const size_t dbSize = (size_t)10485760 * (size_t)8000; // 1MB * 8000 + mdb_env_set_mapsize(env, dbSize); + } sEnvironments.insert(fullPath, env); } } -- cgit v1.2.3