I’ve just find out some sort of solution, i’ll call subprocess for batch with “multiprocessing” save new weights to manager and reinitialize weights before next call. So with end of subprocess occupied memory will get free.