-
Notifications
You must be signed in to change notification settings - Fork 1
Memory leaks
Juan Luis Cano Rodríguez edited this page Mar 9, 2016
·
5 revisions
Investigate this!
import time
import numpy as np
import astropy.units as u
from poliastro.bodies import Earth
from poliastro.iod import vallado, izzo
R_BASE = 1e6
V_BASE = 1e1
TOF_BASE = 86400.0
N_CASES = 1000000
def main():
for ii in range(N_CASES):
k = 3.986004362330e5
r0 = np.random.uniform(-R_BASE, R_BASE, 3)
r = np.random.uniform(-R_BASE, R_BASE, 3)
tof = np.random.uniform(1000.0, TOF_BASE)
solutions = [sol for sol in izzo._lambert(k, r0, r, tof, 0, 35, 1e-8)]
if __name__ == '__main__':
t_start = time.process_time()
print(main())
t_end = time.process_time()
print((t_end - t_start), N_CASES / (t_end - t_start))
Thanks to tracemalloc, I think I determined that the memory leak is numba's fault:
https://gist.github.com/Juanlu001/8efea95892494cf0e65c
Worth investigating.
It has nothing to do with the functions being generators actually.