Skip to content

Instantly share code, notes, and snippets.

@wence-
Created October 21, 2014 16:48
Show Gist options
  • Select an option

  • Save wence-/e32949453feaa6774eb9 to your computer and use it in GitHub Desktop.

Select an option

Save wence-/e32949453feaa6774eb9 to your computer and use it in GitHub Desktop.
import gc
def howmany(cls):
return len([x for x in gc.get_objects() if isinstance(x, cls)])
from firedrake.matrix import Matrix
from firedrake.petsc import PETSc
import gc
gc.collect()
gc.collect()
print 'matrices', howmany(Matrix), howmany(op2.Mat), howmany(PETSc.Mat)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment