How to reduce memory usage with using many rotate key and bootstrap key?

Hi, my the program need to do many rotate with different index. Besides, it also need to do many bootstrapping with sparse packing enabled, this need several bootstrap key generated. All these result in many memory usage, how to reduce the memory usage?

The number of bootstrapping keys can be reduced by adjusting the level budget (for encoding and decoding collapsed FFT) and baby-step-giant-step (BSGS) parameters. See for more information.

Encoding and decoding level budgets can be reduced to reduce the number of keys (at the expense of increasing the multiplicative depth). The BSBG parameters are by default optimized for runtime. One can reduce the number of keys by setting the parameters for encoding/decoding to roughly square root the size of linear transform for each level of collapsed FFT. I suggest reading Improved Bootstrapping for Approximate Homomorphic Encryption (Section 3) for more detailed information.