---
title: "Caching Spaces of Modular Forms"
canonical: "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/HilbertModularForms/hmf-caching.html"
source: "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/HilbertModularForms/hmf-caching.md"
part: "Modular Arithmetic Geometry"
chapter: "Hilbert Modular Forms"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Modular Arithmetic Geometry", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/index-modular-arithmetic-geometry.md"}
  - {"title": "Hilbert Modular Forms", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/HilbertModularForms/index-hilbert-modular-forms.md"}
prev: {"title": "Creation of Full Cuspidal Spaces", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/HilbertModularForms/creation.md"}
next: {"title": "Basic Properties", "source": "https://docs.magma-maths.org/v2.30-1/ModularArithmeticGeometry/HilbertModularForms/basic-properties.md"}
intrinsics:
  - {"name": "SetStoreModularForms", "signature": "SetStoreModularForms(F, v): Fld, BoolElt"}
  - {"name": "ClearStoredModularForms", "signature": "ClearStoredModularForms(F): Fld"}
---

<a id="hmf-caching"></a>
# Caching Spaces of Modular Forms

There is a feature to store spaces that have been computed over a particular field. This typically saves a lot of time in many of the routines, because the algorithms use precomputations and data from existing spaces over the same field. However, these objects also occupy a lot of memory.

By default, no caching is done; the user must manually set it for each field. It is recommended to always do this when the field is created, and then clear the cache whenever memory usage becomes a concern.

Note: in earlier versions (prior to V2.20) caching was always switched on for Hilbert modular forms.

<a id="procedure-setstoremodularforms-fld-boolelt"></a>
## `SetStoreModularForms(F, v): Fld, BoolElt`

If $v$ is `true`, modular forms over the field $F$ that are created afterwards will be cached. If $v$ is `false`, the existing cache is made empty and caching is switched off.

<a id="procedure-clearstoredmodularforms-fld"></a>
## `ClearStoredModularForms(F): Fld`

The cache of modular forms over the field $F$ is made empty. If caching was switched on for $F$, it remains switched on.
