mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 11:50:28 +02:00
Add weak hash table documentation
* doc/ref/api-memory.texi (Weak hash tables): Update documentation. Fixes #20551.
This commit is contained in:
parent
498cd58cb4
commit
8a072fc2d6
1 changed files with 10 additions and 2 deletions
|
@ -309,10 +309,18 @@ Return a weak hash table with @var{size} buckets. As with any
|
||||||
hash table, choosing a good size for the table requires some
|
hash table, choosing a good size for the table requires some
|
||||||
caution.
|
caution.
|
||||||
|
|
||||||
You can modify weak hash tables in exactly the same way you
|
You can modify weak hash tables in exactly the same way you would modify
|
||||||
would modify regular hash tables. (@pxref{Hash Tables})
|
regular hash tables, with the exception of the routines that act on
|
||||||
|
handles. Weak tables have a different implementation behind the scenes
|
||||||
|
that doesn't have handles. @pxref{Hash Tables}, for more on
|
||||||
|
@code{hashq-ref} et al.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
Note that in a weak-key hash table, the reference to the value is
|
||||||
|
strong. This means that if the value references the key, even
|
||||||
|
indirectly, the key will never be collected, which can lead to a memory
|
||||||
|
leak. The reverse is true for weak value tables.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} weak-key-hash-table? obj
|
@deffn {Scheme Procedure} weak-key-hash-table? obj
|
||||||
@deffnx {Scheme Procedure} weak-value-hash-table? obj
|
@deffnx {Scheme Procedure} weak-value-hash-table? obj
|
||||||
@deffnx {Scheme Procedure} doubly-weak-hash-table? obj
|
@deffnx {Scheme Procedure} doubly-weak-hash-table? obj
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue