From 2de881aaadea5b38f5187fab3ca660f7885c2898 Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Wed, 30 Nov 2022 14:05:16 +0800 Subject: [PATCH] refine mmap allocator (#48511) --- paddle/fluid/memory/allocation/mmap_allocator.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/memory/allocation/mmap_allocator.cc b/paddle/fluid/memory/allocation/mmap_allocator.cc index 3c828f13beb..557a9cf333a 100644 --- a/paddle/fluid/memory/allocation/mmap_allocator.cc +++ b/paddle/fluid/memory/allocation/mmap_allocator.cc @@ -74,6 +74,7 @@ void AllocateMemoryMap( "File descriptor %s open failed, unable in read-write mode", filename.c_str())); VLOG(6) << "shm_open: " << filename; + MemoryMapFdSet::Instance().Insert(filename); } } else { fd = -1; @@ -171,11 +172,7 @@ void RefcountedMemoryMapAllocation::close() { void *data = map_ptr_; CountInfo *info = reinterpret_cast(data); if (--info->refcount == 0) { - PADDLE_ENFORCE_NE( - shm_unlink(ipc_name_.c_str()), - -1, - platform::errors::Unavailable( - "could not unlink the shared memory file ", ipc_name_)); + shm_unlink(ipc_name_.c_str()); VLOG(6) << "shm_unlink file: " << ipc_name_; } -- GitLab