diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-15 21:46:18 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-05-15 21:47:20 +0200 |
commit | 83fa63ced28577d8660cbd8224c5627161150685 (patch) | |
tree | bec7d2842b163859e2979570e7cb2683b2188cd0 | |
parent | c668f5acda86b8c2d42cb03f4eceaa509cd9c0a3 (diff) | |
download | sink-83fa63ced28577d8660cbd8224c5627161150685.tar.gz sink-83fa63ced28577d8660cbd8224c5627161150685.zip |
mdb_env_set_mapsize should be called after create but before open
according to the docs.
-rw-r--r-- | common/storage_lmdb.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index a8c5cc7..ddb4f84 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp | |||
@@ -838,6 +838,14 @@ public: | |||
838 | } else { | 838 | } else { |
839 | //Limit large enough to accomodate all our named dbs. This only starts to matter if the number gets large, otherwise it's just a bunch of extra entries in the main table. | 839 | //Limit large enough to accomodate all our named dbs. This only starts to matter if the number gets large, otherwise it's just a bunch of extra entries in the main table. |
840 | mdb_env_set_maxdbs(env, 50); | 840 | mdb_env_set_maxdbs(env, 50); |
841 | if (RUNNING_ON_VALGRIND) { | ||
842 | // In order to run valgrind this size must be smaller than half your available RAM | ||
843 | // https://github.com/BVLC/caffe/issues/2404 | ||
844 | mdb_env_set_mapsize(env, (size_t)10485760 * (size_t)1000); // 1MB * 1000 | ||
845 | } else { | ||
846 | //This is the maximum size of the db (but will not be used directly), so we make it large enough that we hopefully never run into the limit. | ||
847 | mdb_env_set_mapsize(env, (size_t)10485760 * (size_t)100000); // 1MB * 1000 | ||
848 | } | ||
841 | const bool readOnly = (mode == ReadOnly); | 849 | const bool readOnly = (mode == ReadOnly); |
842 | unsigned int flags = MDB_NOTLS; | 850 | unsigned int flags = MDB_NOTLS; |
843 | if (readOnly) { | 851 | if (readOnly) { |
@@ -852,14 +860,6 @@ public: | |||
852 | mdb_env_close(env); | 860 | mdb_env_close(env); |
853 | env = 0; | 861 | env = 0; |
854 | } else { | 862 | } else { |
855 | if (RUNNING_ON_VALGRIND) { | ||
856 | // In order to run valgrind this size must be smaller than half your available RAM | ||
857 | // https://github.com/BVLC/caffe/issues/2404 | ||
858 | mdb_env_set_mapsize(env, (size_t)10485760 * (size_t)1000); // 1MB * 1000 | ||
859 | } else { | ||
860 | //This is the maximum size of the db (but will not be used directly), so we make it large enough that we hopefully never run into the limit. | ||
861 | mdb_env_set_mapsize(env, (size_t)10485760 * (size_t)100000); // 1MB * 1000 | ||
862 | } | ||
863 | Q_ASSERT(env); | 863 | Q_ASSERT(env); |
864 | sEnvironments.insert(fullPath, env); | 864 | sEnvironments.insert(fullPath, env); |
865 | //Open all available dbi's | 865 | //Open all available dbi's |