New submission from Bruce Frederiksen:

The Example in the readline documentation (section 6.7 of the Library 
Reference) shows how to save your readline history in a file, and restore it 
each time you start Python.

The problem with the Example is that it does not include a call to 
readline.set_history_length and the default is -1 (infinite).

As a Python developer, I start Python quite a lot and had a .python_history 
file that was 850M bytes.  Just starting Python was causing my system to thrash 
before the first prompt (>>>) even appeared.

I suggest adding the following line to the example to avoid this:

readline.set_history_length(1000)

I'm not sure how far back this goes in terms of earlier versions of Python, but 
probably quite far.

----------
assignee: docs@python
components: Documentation
messages: 257325
nosy: dangyogi, docs@python
priority: normal
severity: normal
status: open
title: readline example eventually consumes all memory
type: resource usage
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25991>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to