I wrote a Python program that acts on a large input file to create a few million objects representing triangles. The algorithm is:
According to Python Official Documentation, you can force the Garbage Collector to release unreferenced memory with gc.collect(). Example:
gc.collect()
import gc gc.collect()