What is private bytes, virtual bytes, working set?

The short answer to this question is that none of these values are a reliable indicator of how much memory an executable is actually using, and none of them are really appropriate for debugging a memory leak. Private Bytes refer to the amount of memory that the process executable has asked for – not necessarily … Read more

Which Python memory profiler is recommended? [closed]

My module memory_profiler is capable of printing a line-by-line report of memory usage and works on Unix and Windows (needs psutil on this last one). Output is not very detailed but the goal is to give you an overview of where the code is consuming more memory, not an exhaustive analysis on allocated objects. After … Read more

Why is my program slow when looping over exactly 8192 elements?

The difference is caused by the same super-alignment issue from the following related questions: Why is transposing a matrix of 512×512 much slower than transposing a matrix of 513×513? Matrix multiplication: Small difference in matrix size, large difference in timings But that’s only because there’s one other problem with the code. Starting from the original … Read more

How do I discover memory usage of my application in Android?

Note that memory usage on modern operating systems like Linux is an extremely complicated and difficult to understand area. In fact the chances of you actually correctly interpreting whatever numbers you get is extremely low. (Pretty much every time I look at memory usage numbers with other engineers, there is always a long discussion about … Read more

How do I determine the size of an object in Python?

Just use the sys.getsizeof function defined in the sys module. sys.getsizeof(object[, default]): Return the size of an object in bytes. The object can be any type of object. All built-in objects will return correct results, but this does not have to hold true for third-party extensions as it is implementation specific. Only the memory consumption … Read more

Why should C++ programmers minimize use of ‘new’?

There are two widely-used memory allocation techniques: automatic allocation and dynamic allocation. Commonly, there is a corresponding region of memory for each: the stack and the heap. Stack The stack always allocates memory in a sequential fashion. It can do so because it requires you to release the memory in the reverse order (First-In, Last-Out: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)