[Python-Dev] Reduce memory footprint of Python

Antoine Pitrou solipsis at pitrou.net
Wed Oct 9 10:30:05 CEST 2013


Le Wed, 09 Oct 2013 11:01:01 +1300,
Greg Ewing <greg.ewing at canterbury.ac.nz> a écrit :
> R. David Murray wrote:
> > I can give you one data point: a mobile platform that (currently)
> > uses Python3, and does not use linecache because of how much memory
> > it consumes.
> 
> Wouldn't a sensible approach be to discard the linecache
> when you've finished generating a traceback? You're not
> likely to be generating tracebacks often enough to be
> worth keeping it from one to the next.

The linecache is also used by the warnings module. I think the
sensiblest approach would be to limit its size (LRU-style).

Regards

Antoine.




More information about the Python-Dev mailing list