mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-26 03:08:55 -06:00
fix computing the size of the mapped area
This commit is contained in:
@@ -316,7 +316,7 @@ DB::DB(const char* pathname, int flags, int mode) {
|
|||||||
DB::~DB() {
|
DB::~DB() {
|
||||||
if (ms != NULL) {
|
if (ms != NULL) {
|
||||||
size_t size =
|
size_t size =
|
||||||
ms->top + size + sizeof(size_t);
|
ms->top + chunksize(ptr(ms,ms->top)) + sizeof(size_t);
|
||||||
|
|
||||||
munmap(ms,size);
|
munmap(ms,size);
|
||||||
}
|
}
|
||||||
@@ -329,10 +329,11 @@ DB::~DB() {
|
|||||||
|
|
||||||
void DB::sync()
|
void DB::sync()
|
||||||
{
|
{
|
||||||
|
malloc_state *ms = current_db->ms;
|
||||||
size_t size =
|
size_t size =
|
||||||
current_db->ms->top + size + sizeof(size_t);
|
ms->top + chunksize(ptr(ms,ms->top)) + sizeof(size_t);
|
||||||
|
|
||||||
int res = msync((void *) current_db->ms, size, MS_SYNC | MS_INVALIDATE);
|
int res = msync((void *) ms, size, MS_SYNC | MS_INVALIDATE);
|
||||||
if (res != 0)
|
if (res != 0)
|
||||||
throw std::system_error(errno, std::generic_category());
|
throw std::system_error(errno, std::generic_category());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user