From 8aac46d6864d56b1ff2baa4a7b01d2f2e72f28f9 Mon Sep 17 00:00:00 2001 From: Siying Dong Date: Tue, 26 Nov 2013 12:23:02 -0800 Subject: [PATCH] [RocksDB Performance Branch] Fix a regression bug of munmap Summary: Fix a stupid bug I just introduced in b59d4d5a5051263b4bfcef00913219ffe4654e42, which I didn't even mean to include. GCC might remove the munmap. Test Plan: Run it and make sure munmap succeeds Reviewers: haobo, kailiu Reviewed By: kailiu CC: dhruba, reconnect.grayhat, leveldb Differential Revision: https://reviews.facebook.net/D14361 --- util/env_posix.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/env_posix.cc b/util/env_posix.cc index c6995b30c..1643d2927 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -307,7 +307,11 @@ class PosixMmapReadableFile: public RandomAccessFile { assert(options.use_os_buffer); } virtual ~PosixMmapReadableFile() { - assert(munmap(mmapped_region_, length_) == 0); + int ret = munmap(mmapped_region_, length_); + if (ret != 0) { + fprintf(stdout, "failed to munmap %p length %zu \n", + mmapped_region_, length_); + } } virtual Status Read(uint64_t offset, size_t n, Slice* result,