Date: Fri, 23 Nov 2001 19:29:06 -0500 From: The Anarcat <anarcat@anarcat.dyndns.org> To: libh@FreeBSD.org Subject: Does one need to free H:: data structures? (Re: cvs commit: libh/release/diskedit TODO) Message-ID: <20011124002905.GB27297@shall.anarcat.dyndns.org> In-Reply-To: <20011115195849.GI2447@shall.anarcat.dyndns.org> References: <200111151950.fAFJojw07191@usw4.freebsd.org> <20011115195849.GI2447@shall.anarcat.dyndns.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--ZoaI/ZTpAVc4A5k6
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Thu Nov 15, 2001 at 02:58:50PM -0500, The Anarcat wrote:
> On Thu Nov 15, 2001 at 01:50:45PM -0600, Antoine Beaupr=E9 wrote:
> > antoine 2001/11/15 13:50:45 CST
> >=20
> > Modified files:
> > release/diskedit TODO=20
>=20
> There is an interesting item in there, to say the least...
>=20
> o free data???
>=20
> In libdisk, there are lovely things such as Free_Disk. I never actually
> bothered to verify in detail, but I think there is some kind of dynamic
> garbage collection in TCL, right? So the question is:
>=20
> Do I need to free H:: data structures???
=46rom the tests I ran, yes, you need to free H:: data structures. I don't
understand why, and IMHO, it shouldn't be that way, but it's obvious.
The test program:
set free [lindex $argv 0]
set iter [lindex $argv 1]
if {$iter =3D=3D ""} {set iter 8}
for {set i 0} {$i < $iter} {incr i} {
set disk [Disk "ad0"]
puts "$i: $disk"
if {$free} {
H::delete $disk
}
}
puts "done, press enter to finish"
gets stdin
Yields:
anarcat@shall[~/libh]% tclh.static mem-test.tcl 1 8192
0: 0x8882d18_4Disk
1: 0x8882d18_4Disk
2: 0x8882d18_4Disk
3: 0x8882d18_4Disk
4: 0x8882d18_4Disk
=2E..
UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TT TIME COMMAND
1000 27368 27273 84 3 0 9512 2928 ttyin S+ p2 0:20.38 tclh.sta=
tic mem-test.tcl 1 8192
and:
anarcat@shall[~/libh]% tclh.static mem-test.tcl 0 8192
0: 0x8882d18_4Disk
1: 0x8886118_4Disk
2: 0x88864d8_4Disk
3: 0x8886898_4Disk
4: 0x8886c58_4Disk
=2E..
UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TT TIME COMMAND
1000 27383 27273 128 44 0 19784 12564 - R+ p2 0:26.04 tclh.st=
atic mem-test.tcl 0 8192
I guess that settles it.
A.
--ZoaI/ZTpAVc4A5k6
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAjv+6dAACgkQttcWHAnWiGcXBACfQT3VjtUx8LcvDrvRy8p0fwPX
56gAn0EcYLLAB9V7S2vGCxvbbOigLuqh
=1Hvh
-----END PGP SIGNATURE-----
--ZoaI/ZTpAVc4A5k6--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-libh" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011124002905.GB27297>
