Roman,
This problem was addressed in a discussion thread back in 2006. I had
to look for it to remember the details. The authors of DTrace didn''t
include any way to release the storage for an associative array of
structures. The discussion was, that maybe they should have included an
"undef", but I''m not sure why they didn''t just allow
you to set the
record equal to 0, the way you do with an element of an array of scalars.
I tried it in Solaris 10 8/07, and it still doesn''t work. I''m
not sure
if it''s been addressed in OpenSolaris.
So your best bet is to break down the structure into several arrays of
scalars. The elements in these can then be released by assigning 0 to
the element.
Chip
Roman Shaposhnik wrote:> First things first: Happy New Year and best of wishes for 2008!
>
> Now back to our regularly scheduled programming: perhaps
> the following question is an FAQ but Google doesn''t seem to
> be of that opinion.
>
> How does one zeroes out non integer entries in the associative
> array? Suppose I have the following:
>
> struct foo {
> int bar;
> string goo;
> } foo_records[int];
>
> and I want to release the memory occupied by foo_records[25].
> Do I have to zero out each individual member
> foo_records[25].bar = 0;
> foo_records[25].goo = "";
> or is there a better way?
>
> And by the way, am I correct in assuming that the way to
> zero out strings is, indeed:
> foo_records[25].goo = ""
> ?
>
> Thanks,
> Roman.
>
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
>