[docs] [issue25991] readline example eventually consumes all memory

Bruce Frederiksen report at bugs.python.org
Fri Jan 1 23:28:53 EST 2016


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 at python
components: Documentation
messages: 257325
nosy: dangyogi, docs at python
priority: normal
severity: normal
status: open
title: readline example eventually consumes all memory
type: resource usage
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25991>
_______________________________________


More information about the docs mailing list