# Sagemath heap size limit [closed]

Hi all, I am not new to Python, but new to Sagemath.

My code:

```
v = MatrixSpace(GF(2), 2, 6)
size = binomial(4096,3)
g3 = []
for c in Combinations(range(4096), 3):
m = block_matrix(3, 1, [v[c[0]], v[c[1]], v[c[2]]])
if m.rank() >= 4:
g3.append(c)
```

The variable "g3" raises up to about 20 GB in total. Sagemath catches "Memory Error" at some point; therefore, I divide "g3" into 1920 different parts to save. Now I need to process further with "g3", i.e. I need to assign "g3" parts again to some variables to use. The 1st solution that I think of is to create 1920 different variables to store the whole "g3" in my code; however, this way is a bit inconvenient.

Is there any better solution?

For example, increasing the limit of "list" size (python list type []), which might help me to save up to 11.444.858.880 lists in the list "g3" (about 11 billion is the size from binomial(4096,3)). I have a computer of 128 GB RAM, and it is very nice if I can utilize the computer's strength.

There is an old topic on this: trac.sagemath.org/ticket/6772. However, I do not really get the idea there.

I wish to be supported :-) Thank you a lot !!!

Why do you need to physically save such an object with an easy generator? We do not have the (maybe $10\times 100$ matrix)

`v`

, but even if the range condition makes a rare selection among the many involved`c`

's, what do you further want to do with this list?Trying to run your code in a fresh Sage session, one gets:

I edited my post adding v:

@dan_fulea, I would like to share with you further process. Example:

1)

`g3`

is a list of all`c`

involved in good combinations, i.e. condition`m.rank() >= 4`

is satisfied (its result is still a huge list, which we can see by running @slelievre suggestion`sum(1 for g in g3)`

, which almost non-stop) 2) I process each list in g3 to learn relationship of any pairs, e.g:3) Consider (1,2,3), we know (1,2) can go with 4, or 5 besides 3. If all (1 ...(more)