Boost logo

Boost :

Subject: Re: [boost] [interprocess] 32-bit offset_ptr
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2019-02-02 17:19:13


AMDG

On 2/2/19 9:28 AM, Phil Endecott via Boost wrote:
> I have some old code that uses 32-bit offset_ptrs, i.e.
>
>   typedef boost::interprocess::offset_ptr<void, int32_t, int32_t> ptr_t;
>
> This has stopped working on 64-bit systems at some point since 1.58. 
> git blame
> suggests a commit on  14 Oct 2015.  There is now a static assert that
> checks that
> OffsetType is at least as large as a raw pointer.
>
> In the current case, I'm using these pointers within memory-mapped files
> which will
> always be vastly smaller than the 32-bit limit.  Using 32-bit offsets
> seemed
> like a worthwhile optimisation at the time, and now I am hoping to maintain
> binary compatibility with those files.
>

The offset_ptr is not restricted to existing inside
the memory-mapped file. The library can and
does create temporaries.

> In the past I've also used them to save memory on 64-bit systems with
> pointer-heavy
> data structures (using boost.intrusive) using an allocator that operates
> within a
> small memory region.
>
> Has something changed within the implementation that makes this restriction
> necessary?  Was it never supposed to work as I was using it?
>
> There is also an assert that OffsetType is unsigned, which wasn't there
> before.
> Maybe I was doing that wrong.
>

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk