Bugzilla – Bug 2216
Based pointer repository not updated when using persistent memory pools
Last modified: 2005-08-29 04:20:48
You need to log in before you can comment on or make changes to this bug.
When an ACE_MMAP_Memory_Pool is created using an existing backing store. The ACE_Based_Pointer_repository is not updated with the mapped segment information. The following code demonstrates the issue: int mmap_remap_test(void) { MMAP_Allocator* alloc; ACE_OS::unlink("foo"); { ACE_NEW_RETURN (alloc, MMAP_Allocator ("foo", "foo"), -1); alloc->sync(); // Delete Malloc and the memory pool, but do not remove // the backing store alloc->memory_pool().release(0); delete alloc; } // // Recreate segment with existing backing store // ACE_NEW_RETURN (alloc, MMAP_Allocator ("foo", "foo"), -1); void* addr = alloc->base_addr(); if(addr == 0) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to get base to remapped MMAP Memory Pool\n")), -1); } void* ba; if(ACE_BASED_POINTER_REPOSITORY::instance()->find(addr, ba) == -1) { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to find base address after remap of segment\n")), -1); } if(!ba) \\ <--*** fails here, ba is zero *** { ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("No base address mapping after remap\n")), -1); } delete alloc; return 0; }
I have added this test to the test program I wrote for: http://deuce.doc.wustl.edu/bugzilla/show_bug.cgi?id=1991
I have a patch file that corrects this issue by binding the segment to the Based_Pointer_Repository in the case that the backing file already exists.
Created an attachment (id=370) [details] Patch for proposed fix
Mon Aug 29 09:20:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl> * ace/MMAP_Memory_Pool.cpp: Fixed bugzilla bug 2216, when an ACE_MMAP_Memory_Pool is created using an existing backing store, the ACE_Based_Pointer_repository was not updated with the mapped segment information. Thanks to Steve Williams <steve at telxio dot com> for reporting this and supplying the fix and regression test below.