//!mapped memory page, accessing that page can trigger a segmentation fault.
//!Depending on the OS, this operation might fail (XSI shared memory), it can decommit storage
//!and free a portion of the virtual address space (e.g.POSIX) or this
- //!function can release some physical memory wihout freeing any virtual address space(Windows).
+ //!function can release some physical memory without freeing any virtual address space(Windows).
//!Returns true on success. Never throws.
bool shrink_by(std::size_t bytes, bool from_back = true);
if(m_base == 0)
return false;
- if(mapping_offset >= m_size || (mapping_offset + numbytes) > m_size){
+ if(mapping_offset >= m_size || numbytes > (m_size - size_t(mapping_offset))){
return false;
}
(offset_t mapping_size, offset_t offset, offset_t page_offset, std::size_t &size)
{
//Check if mapping size fits in the user address space
- //as offset_t is the maximum file size and its signed.
+ //as offset_t is the maximum file size and it's signed.
if(mapping_size < offset ||
boost::uintmax_t(mapping_size - (offset - page_offset)) >
boost::uintmax_t(std::size_t(-1))){
error_info err(size_error);
throw interprocess_exception(err);
}
- size = static_cast<std::size_t>(mapping_size - (offset - page_offset));
+ size = static_cast<std::size_t>(mapping_size - offset);
}
inline offset_t mapped_region::priv_page_offset_addr_fixup(offset_t offset, const void *&address)
template<int dummy>
inline std::size_t mapped_region::page_size_holder<dummy>::get_page_size()
{
- winapi::system_info info;
+ winapi::interprocess_system_info info;
winapi::get_system_info(&info);
return std::size_t(info.dwAllocationGranularity);
}