Hello, gdbm module has specific design: – hashtable is always empty – getnode() returns heap-arena allocated (hcalloc) Param each time a key is referenced – the Param is PM_SCALAR, but it has u.hash set – this is to pass aroud GDBM_FILE in u.hash.tmpdata – the Param interfaces to database, never creates u.str (it cannot, would overwrite u.hash), returns GDBM internal strings I've rewritten the module: – hashtable is filled normally, initially with ~PM_UPTODATE – Param "dereference" detects ~PM_UPTODATE, uses database, sets u.str, sets PM_UPTODATE – GDBM_FILE is passed around in gsu_scalar extension: struct gsu_scalar_ext { struct gsu_scalar std; GDBM_FILE dbf; }; – normal ztrdup() strings are returned from Param This way there is no subtle memory leak when doing: while (( 1 )); do val=tied_param[key]; done Tested this and top values were 100 MiB and rising. Created also extensive tests (following V10private.ztst), doing things like +=( ), unset on not existing (in Zsh) key, but existing in database, scoping. I develop this as pluggable module psprint/zgdbm, here I submit a few days of work. I might further expand and submit to upstream, but what's there now is a finished work, confirmed by complete testing. Sending as patch and alternatively 2 separate files. PS. Maybe this: #define PM_UPTODATE (1<<19) /* Parameter has up-to-date data (e.g. loaded from DB) */ could be moved to zsh.h. It can be fairly common for every frontend-like module to use parameters that are not "up to date". -- Sebastian Gniazdowski psprint2@fastmail.com