Re: Memory escaping while using array reallocation.
Peter Pentchev <[email protected]>
| Newsgroups | gmane.comp.db.mysql.perl |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Dec 06, 2004 at 12:55:00PM +0300, webmaster wrote:
> Hi, everybody.
>
> I'm wondering if I use next instructions:
> while ( [some condition] ) {
> my @array = (1,2,3,4,5,6);
> ... some code ...
> @array = ();
> }
> then I hope Perl environment must be care about sufficient usage memory
> zone, occupied by array allocation during first declaration (e.g. my @array
> = (1,2,3,4,5,6);). Does it clean up all elements of array properly while
> proccessing statement '@array = ()' ?
Perl's garbage collection mechanisms guarantee that the memory allocated
for the members (scalars, if they are just 1, 2, 3, 4, 5, 6, or arrays /
hashes / objects referenced by the members, if they are not just
scalars) WILL be freed at some point in the future, but it does NOT
guarantee that it will be freed immediately. See the 'perlobj' page in
perldoc for details.
G'luck,
Peter
--
Peter Pentchev [email protected] [email protected] [email protected]
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553
This sentence was in the past tense.
signature.asc
(application/pgp-signature, 187 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFBtYXJ7Ri2jRYZRVMRAnfHAJ4r2WOySR1fk/vuSqpwxoCWP4vFAACdG0mS xGN287LYF6Wb3JLPD5SGR5I= =hFfu -----END PGP SIGNATURE-----