From 4ae66f0672eeec87963beeb9aefec86794ccb0b6 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 27 Oct 2019 03:42:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmmap=E7=9B=B8=E5=85=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpBody.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Http/HttpBody.cpp b/src/Http/HttpBody.cpp index ff923ac4..cc4aced4 100644 --- a/src/Http/HttpBody.cpp +++ b/src/Http/HttpBody.cpp @@ -34,7 +34,7 @@ #endif #ifndef _WIN32 -//#define ENABLE_MMAP +#define ENABLE_MMAP #endif namespace mediakit { @@ -74,7 +74,7 @@ HttpFileBody::HttpFileBody(const std::shared_ptr &fp, uint64_t offset, uin WarnL << "mmap failed:" << get_uv_errmsg(false); break; } - _map_addr.reset(ptr,[max_size](char *ptr){ + _map_addr.reset(ptr,[max_size,fp](char *ptr){ munmap(ptr,max_size); }); } while (false);