My question is how to clear a record from memory.
Specifically, a lattice record. This is the context:
Compute the lattice of the AlternatingGroup(8). Now
for subgroups of this group, compute a lattice. I
don't want to do it all at once. I would be happy to
just be able to replace an old subgroup lattice with
a new subgroup lattice.
Redefining the old subgroup lattice as the new
subgroup lattice does not seem to work. In other words,
after a few replacements, I still run out of memory.
Is the information of the old subgroup lattice able to
be cleared from memory?
Yes, it is. The memory manager in GAP will recover the space used by
any object which is no longer "reachable". That is, it is no longer
stored in a variable, or a member of a record that is reachable, or
an element of an array that is reachable. The problem in this case
is that when you execute
l := Lattice(h);
the lattice is actually stored in TWO places. Firstly it is stored
in the variable l, from which you successfully delete it when you
change the value of l. Secondly, it is stored as h.lattice in
the record for the group h, to save time should it be required again.
Thus to reclaim the space, you need to do something like:
for h in .... do l := Lattice(h); <do stuff with l> Unbind(h.lattice); od;
then when you reassign l on each pass through the loop, the lattice
computed on the last pass will un "unreachable" and the space it
uses can be reclaimed.
I would further remark that if you alrady have the lattice of G,
then it should be possible to extract the lattice of H <= G from
that of G without going to the trouble of recomputing it.