diff --git a/src/serialize.h b/src/serialize.h --- a/src/serialize.h +++ b/src/serialize.h @@ -25,6 +25,12 @@ static const uint64_t MAX_SIZE = 0x02000000; +/** + * Maximum amount of memory (in bytes) to allocate at once when deserializing + * vectors. + */ +static const unsigned int MAX_VECTOR_ALLOCATE = 5000000; + /** * Dummy data type to identify deserializing constructors. * @@ -866,7 +872,7 @@ size_t i = 0; size_t nMid = 0; while (nMid < nSize) { - nMid += 5000000 / sizeof(T); + nMid += MAX_VECTOR_ALLOCATE / sizeof(T); if (nMid > nSize) { nMid = nSize; } @@ -938,7 +944,7 @@ size_t i = 0; size_t nMid = 0; while (nMid < nSize) { - nMid += 5000000 / sizeof(T); + nMid += MAX_VECTOR_ALLOCATE / sizeof(T); if (nMid > nSize) { nMid = nSize; }