1, change the source to recompile printing related information
The obmalloc.c file prints Maxarenas, the value is the number of arena assigned to the current environment, and the allocation of arena does not immediately allocate the corresponding pools, so for each arena,nfreepools and Ntotalpools The number of available pool and total pool to be allocated for the pool.
intArena_len =0;int_nfreepools =0 ;int_ntotalpools =0;inti; for(i =0; i<maxarenas;++i) { if(Arenas[i].address = =0) Continue; Arena_len++; _nfreepools+=Arenas[i].nfreepools; _ntotalpools+=Arenas[i].ntotalpools;}
Mainly this information: Maxarenas indicates the number of arena allocated, _ntotalpools indicates the number of pools allocated (memory pool capacity is _ntotalpools *4kb, each pool is 4KB).
2, Guppy
Need to be installed,
HP = Guppy.hpy ()
Hp.heap ()
You can view the current Python environment variables using memory conditions (including memory pools and non-memory pools).
There are many more ways to use it, for reference:
Http://smira.ru/wp-content/uploads/2011/08/heapy.html
3, Psutil
gets the process and system utilization (including CPU, memory, disk, network, etc.) information that the system is running.
For details, refer to:
Http://www.cnblogs.com/liu-yao/p/5678157.html
Python Memory analysis