[m-rev.] for review: Make version_array's rewind code use constant stack space.
Paul Bone
paul at bone.id.au
Thu Apr 10 18:51:38 AEST 2014
On Thu, Apr 10, 2014 at 06:08:01PM +1000, Paul Bone wrote:
>
> Make version_array's rewind code use constant stack space.
>
> Although rewinding version arrays should be rare it is better if this code
> uses constant stack space to avoid crashes. Currently the list of updates
> made in a version array is kept in a singly linked list. This list needs to
> be walked backwards to unwind updates, such as when updating an old version
> of an array (to fork into two separate arrays). The stack is used to
> perform this backwards work and can overflow for long histories.
>
> This patch makes these lists doubly-linked so that they can be traversed in
> either direction. I'm willing to bet that this unwind code is also faster.
>
I would like to retract this proposal. Using a doubly linked list will
retrain too much memory. We need no-longer referenced 'old' array changes
to be freed by the GC.
As alternatives I will consider using weak pointers for the prev pointer or
using a singly linked list and solving my original problem by using
temporary heap storage to walk the list backwards.
Thanks.
--
Paul Bone
More information about the reviews
mailing list