Skip to content

Commit a5adc9a

Browse files
committed
Use internal LevelDB test interface to bump LevelDB mmap limit up to 4096 like Bitcoin Core's fork
No-op for embedded, but still done anyway Not applicable to Windows or 32-bit systems
1 parent 2e6765c commit a5adc9a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/dbwrapper.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,26 @@ bool dbwrapper_SanityCheck()
7070
return true;
7171
}
7272

73+
#ifndef WIN32
74+
namespace leveldb {
75+
class EnvPosixTestHelper {
76+
static void SetReadOnlyMMapLimit(int limit);
77+
public:
78+
static inline void SetReadOnlyMMapLimitForBitcoin(int limit) { SetReadOnlyMMapLimit(limit); }
79+
};
80+
}
81+
82+
class BitcoinLevelDBInit {
83+
public:
84+
BitcoinLevelDBInit() {
85+
if (sizeof(void*) >= 8) {
86+
leveldb::EnvPosixTestHelper::SetReadOnlyMMapLimitForBitcoin(4096);
87+
}
88+
}
89+
};
90+
static BitcoinLevelDBInit g_bitcoin_leveldb_init;
91+
#endif
92+
7393
class CBitcoinLevelDBLogger : public leveldb::Logger {
7494
public:
7595
// This code is adapted from posix_logger.h, which is why it is using vsprintf.

0 commit comments

Comments
 (0)