memory-leaks

MPIRE WorkerPool causes memory leak

MPIRE WorkerPool causes memory leak Question: I have a python module with a function that runs in an infinite loop. Within this function I create WorkerPool with the mpire library. I cannot use the standard multiprocessing library because I have to pass non-picklable objects to the worker functions (at least I have not yet found …

Total answers: 1

Increased amount of memory usage using Kera's fit() method

Increased amount of memory usage using Kera's fit() method Question: Using TF 2.11.0 with a GPU on Colab. I am getting an increased amount of system memory used per batch when let the fit() method run (This code only checks per epoch). This is a very basic CycleGAN class: import psutil import gc from keras.callbacks …

Total answers: 1

How to pass arguments to another .py

How to pass arguments to another .py Question: I’m newbie with python programming and I’m facing an issue with Windows Memory, so I want to understand if the way I’m calling the other "subprogram" ic causing this problem. Basically I’ve done a main program from which I call the other .py (called second_py.py) like this: …

Total answers: 1

Threading in Pygame causing Memory leak

Threading in Pygame causing Memory leak Question: I am creating an Asteroids Game. the game is intended for use over long periods of time. on startup (using pycharms debugg tool) i am using roughly 30.1 MB of system memory. however i have noticed that while running, it increases by roughly 0.1 MB every second (with …

Total answers: 1

Joblib Parallel doesn't terminate processes

Joblib Parallel doesn't terminate processes Question: I run the code in parallel in the following fashion: grouped_data = Parallel(n_jobs=14)(delayed(function)(group) for group in grouped_data) After the computation is done I can see all the spawned processes are still active and memory consuming in a system monitor: And all these processes are not killed till the main …

Total answers: 2

'unlink()' does not work in Python's shared_memory on Windows

'unlink()' does not work in Python's shared_memory on Windows Question: I am using Python 3.8’s new shared_memory module and fail to free the shared memory without terminating the processes using it. After creating and using a block shm of shared memory, I close it via shm.close() in all processes and finally free it via shm.unlink …

Total answers: 2

Tensor is not an element of this graph

Tensor is not an element of this graph Question: I’m getting this error ‘ValueError: Tensor Tensor(“Placeholder:0”, shape=(1, 1), dtype=int32) is not an element of this graph.’ The code is running perfectly fine without with tf.Graph(). as_default():. However I need to call M.sample(…) multiple times and each time the memory won’t be free after session.close(). Probably …

Total answers: 7

Python: how to get size of all objects in current namespace?

Python: how to get size of all objects in current namespace? Question: I have some code that I am running from my own package and the program is using a lot more memory (60GB) than it should be. How can I print the size of all objects (in bytes) in the current namespace in order …

Total answers: 3

Does setting numpy arrays to None free memory?

Does setting numpy arrays to None free memory? Question: I have hundreds of really larges matrices, like (600, 800) or (3, 600, 800) shape’d ones. Therefore I want to de-allocate the memory used as soon as I don’t really need something anymore. I thought: some_matrix = None Should do the job, or is just the …

Total answers: 3

How to use valgrind with python?

How to use valgrind with python? Question: I am trying to memcheck a C python extension I am writing, but I’m having trouble setting up valgrind to work with python. I would really appreciate some advice. Just for context, this is Ubuntu 13.10, python 2.7.5+, and valgrind 3.8.1. As per recommendation from Readme.valgrind I did …

Total answers: 2