
The other day, while working on fpdf2,
I used @dataclass
,
a nice decorator that came in the standard library with Python 3.7,
to quickly define a class
that mostly stored data.
Then a question came to my mind: is the __slots__
memory optimization compatible with …
This describes tools and techniques that can identify memory leaks in Long running Python programs:
- Is it a Leak?
- Sources of Leaks
- A Bit About (C)Python Memory Management
- Reference Counts
- Garbage Collection
- The Big Picture
- CPython’s Object Allocator (pymalloc)
Here is a visualisation of memory allocators from top to bottom (from the Python source Objects/obmalloc.c):
_____ ______ ______ ________
[ int ] [ dict ] [ list ] ... [ string ] Python core |
+3 | <----- Object-specific memory -----> | <-- Non-object memory --> |
_______________________________ | |
[ Python's object allocator ] | |
+2 | ####### Object memory ####### | <------ Internal buffers ------> |
______________________________________________________________ |
[ Python's raw memory allocator (PyMem_ API) ] |
+1 | <----- Python memory (under PyMem manager's control) ------> | |
__________________________________________________________________
[ Underlying general-purpose allocator (ex: C library malloc) ]
0 | <------ Virtual memory allocated for the python process -------> |
=========================================================================
_______________________________________________________________________
[ OS-specific Virtual Memory Manager (VMM) ]
-1 | <--- Kernel dynamic storage allocation & management (page-based) ---> |
__________________________________ __________________________________
[ ] [ ]
-2 | <-- Physical memory: ROM/RAM --> | | <-- Secondary storage (swap) --> |
He found that the more HTTP client requests he did, the more memory his Node process would consume, but it was really slow.
[...] Then I ran Node with UMEM_DEBUG set to record various important information about the memory allocations
[...] Every hour, it grabbed the output of pmap -x and a core file and stored those in Joyent Manta
[...] In MDB there's a particularly helpful command ::findleaks that will show you the memory addresses and the stack traces for leaked memory, not unlike using valgrind, but without all the performance penalty.
[...] At this point we knew that we were looking for something in v0.10 that called MakeCallback but that didn't first have a HandleScope on the stack. I then worked up this simple DTrace script.

Un jeu d'action-plates-formes en deux dimensions où l'on incarne un samouraï, un assassin à la mémoire vacillante dans les bas quartiers d'une mégalopole néo-noire, La Nouvelle Mecque. Il est question de violence à outrance, d'une mise en scène hypnotique, demandant au joueur de la réaction et de la rapidité d'improvisation.
Un excellent jeu, très inspiré d'Hotline Miami pour l'ambiance et une partie du gameplay. J'ai aussi trouvé que l'histoire et la narration rappelait la série Metal Gear Solid.

Le Cône d’Apprentissage d’Edgar Dale a été récemment repris par les équipes d'HEC Montréal qui l'ont "transformé" en pyramide.
Deux paramètres déterminants :
- le nombre de canaux
- le degré de participation (le curseur "actif / passif")
Petite technique mnémotechnique que j'avais appris étudiant.
Je me la note ici pour la retrouver facilement
L’essentiel est de faire appel à des images mentales qui soient toujours...
- Dynamiques
- Colorées
- Exagérées