memory

How to cleanup RAM between program iterations using Python

How to cleanup RAM between program iterations using Python Question: Problem I have a Python application inside Docker container. The application receives "jobs" from some queue service (RabbitMQ), does some computing tasks and uploads results into database (MySQL and Redis). The issue I face is – the RAM is not properly "cleaned up" between iterations …

Total answers: 1

How to log Python code memory consumption?

How to log Python code memory consumption? Question: Question Hi, I am runnin’ a Docker container with a Python application inside. The code performs some computing tasks and I would like to monitor it’s memory consumption using logs (so I can see how different parts of the calculations perform). I do not need any charts …

Total answers: 2

python ctypes memory read stops at first zero integer

python ctypes memory read stops at first zero integer Question: To all ctypes experts: I am running this code in Python to read 0x400 entries from memory. Unfortunately the returned list only contains ~20 entries. It seems to stop reading at the first entry with the value equal to 0. read_buffer = (ctypes.c_char * buffsize)() …

Total answers: 1

C++ vs Python | Read Memory

C++ vs Python | Read Memory Question: Have working code in C++ and would like to get equivalent results with Python. The idea is to retrieve data from memory using a specific process and a pointer. The result should look like this as it works in C++: Here is the C++ code: hProcess = SOME_HANDLER …

Total answers: 1

NetCDF4 file with Python – Filter before dataframing

NetCDF4 file with Python – Filter before dataframing Question: Due to a large NetCDF4 file, I get a MemoryError when I want to transform it into Pandas dataframe. But I don’t need everything from the netCDF4 file, so I wanted to know if I could cut the file priorly, and after transforming into dataframe My …

Total answers: 1

Questions about Rust BigInt memory allocation and performance compared to Python BigInt implementation

Rust BigInt memory allocation and performance compared to Python BigInt implementation Question: When working with num_bigint::BigInt I have run into some performance limitations, for context I am working on https://www.geeksforgeeks.org/how-to-generate-large-prime-numbers-for-rsa-algorithm/ [full code at bottom of page]. In the nBitRand function we essentially shuffle a vector of BigInt’s determined by the range: (2.pow(n – 1) + …

Total answers: 2

How to get a flattened view of PyTorch model parameters?

How to get a flattened view of PyTorch model parameters? Question: I want to have a flattened view of the parameters belonging to my Pytorch model. Note it should be a view and not a copy of the parameters. In other words, when I modify the parameters in the view it should also modify the …

Total answers: 1

Why does Python's functools.partial definition use function attributes?

Why does Python's functools.partial definition use function attributes? Question: In the functools.partial example definition, function attributes are used in the returned partial function object: def partial(func, /, *args, **keywords): def newfunc(*fargs, **fkeywords): newkeywords = {**keywords, **fkeywords} return func(*args, *fargs, **newkeywords) newfunc.func = func newfunc.args = args newfunc.keywords = keywords return newfunc What would be the …

Total answers: 3