> < ^ Date: Tue, 30 Jan 2001 12:30:12 +0000
> < ^ From: Steve Linton <sal@dcs.st-and.ac.uk >
< ^ Subject: Re: memory flush?

Dear GAP Forum,

Gordon Royle asked about memory problems with LatticeSubgroups.

In GAP4, LatticeSubgroups is an Attribute, and most complex objects (such as
groups) store the values of any of their attributes that are computed, for
later reuse. Thus, if you ask twice for the lattice of subgroups of the same
group, it will take almost no time, and will simply return the stored value.
What I suspect is happening in your case is that you have a list of groups and
are computing their lattices. Since the list is still reachable, each of the
groups is, and so each of their lattices is still stored.

There are a three possible ways round this:

1. After each iteration of the loop, explicitly unbind the group that you have
processed from the list. Something like:

  	for i in [1..Length(l)] do
 		g := l[i];
 		# do stuff to g
2. In each iteration make a different (but equal group) to work with (which 
will then be garbage collected) by
	for g in groups do
	g1 := Group(GeneratorsOfGroup(g), One(g));
	# do stuff to g1

3. Before your loop do

DisableAttributeValueStoring( LatticeSubgroups )

this will prevent the value being stored (although many related or intermediate
values may still be stored). You will need to be careful to ensure that the
lattice is not then computed more than once per group. Doing

TraceMethods( LatticeSubgroup )

will help you to see if this is happening.

Steve Linton

> < [top]