develooper Front page | perl.perl5.porters | Postings from August 2021

Re: Robin Hood Hashing for the perl core

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
August 7, 2021 10:25
Subject:
Re: Robin Hood Hashing for the perl core
Message ID:
YQ5feLlk3JltPxKf@iabyn.com
On Tue, Aug 03, 2021 at 02:27:42PM +0000, Nicholas Clark wrote:
> The proposed implementation "open addressing" eliminates the linked lists by
> storing HE structs in a flat array:

So in effect HvARRAY() changes from being an array of SV pointers to an
array of HE structs?

How will this affect the hv_fetch_ent() and similar functions, which
return a pointer to a HE? In particular what happens to such a pointer if
the HvARRAY() gets reallocated in the meantime. E.g.

    HE *he = hv_fetch_ent(hv, ...);
    hv_store(hv,...); /* XXX triggers HvARRAY realloc */
    do_something_with(he->val); /* using freed memory! */


-- 
"Emacs isn't a bad OS once you get used to it.
It just lacks a decent editor."

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About