This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document that [ah]v_undef/clear may free the [ah]v
authorFather Chrysostomos <sprout@cpan.org>
Tue, 10 Jan 2012 03:59:45 +0000 (19:59 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 10 Jan 2012 03:59:45 +0000 (19:59 -0800)
av.c
hv.c

diff --git a/av.c b/av.c
index 472600b..1114531 100644 (file)
--- a/av.c
+++ b/av.c
@@ -426,8 +426,11 @@ Perl_av_make(pTHX_ register I32 size, register SV **strp)
 /*
 =for apidoc av_clear
 
-Clears an array, making it empty.  Does not free the memory used by the
-array itself.  Perl equivalent: C<@myarray = ();>.
+Clears an array, making it empty.  Does not free the memory the av uses to
+store its list of scalars.  If any destructors are triggered as a result,
+the av itself may be freed when this function returns.
+
+Perl equivalent: C<@myarray = ();>.
 
 =cut
 */
@@ -488,7 +491,9 @@ Perl_av_clear(pTHX_ register AV *av)
 /*
 =for apidoc av_undef
 
-Undefines the array.  Frees the memory used by the array itself.
+Undefines the array.  Frees the memory used by the av to store its list of
+scalars.  If any destructors are triggered as a result, the av itself may
+be freed.
 
 =cut
 */
diff --git a/hv.c b/hv.c
index 2cfe25b..baeeae7 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -1546,7 +1546,10 @@ Perl_hv_delayfree_ent(pTHX_ HV *hv, register HE *entry)
 =for apidoc hv_clear
 
 Frees the all the elements of a hash, leaving it empty.
-The XS equivalent of %hash = (). See also L</hv_undef>.
+The XS equivalent of C<%hash = ()>.  See also L</hv_undef>.
+
+If any destructors are triggered as a result, the hv itself may
+be freed.
 
 =cut
 */
@@ -1768,10 +1771,14 @@ Perl_hfree_next_entry(pTHX_ HV *hv, STRLEN *indexp)
 /*
 =for apidoc hv_undef
 
-Undefines the hash.  The XS equivalent of undef(%hash).
+Undefines the hash.  The XS equivalent of C<undef(%hash)>.
 
 As well as freeing all the elements of the hash (like hv_clear()), this
 also frees any auxiliary data and storage associated with the hash.
+
+If any destructors are triggered as a result, the hv itself may
+be freed.
+
 See also L</hv_clear>.
 
 =cut