Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8277955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:51:03+00:00 2026-06-08T08:51:03+00:00

When I run the python 2.7 interactive shell (in Ubuntu 12.04 LTS) I get

  • 0

When I run the python 2.7 interactive shell (in Ubuntu 12.04 LTS) I get what appears to be a memory leak. When I launch an interactive shell, the memory usage steps up at a fairly even rate until all the ram (3.9gb) is used, then it knocks back to 80% (ish) and swap space jumps up by ~200-400mb and it levels off and offers the prompt, but any further interaction pushes the RAM usage back to 100% where it stays (rendering the system pretty much inoperable).

The interactive shell can be launched from a gnome terminal, or when ssh’d into the computer from another box (I was testing using connectbot for android), and the same problem occurs.

EDIT:
I removed my .pythonrc.py file and the problem seems to have disappeared. I did not change it recently (I created it a month ago and haven’t touched it since, this problem started yesterday).

Here is my pythonrc file (.pythonrc.py)

import atexit 
import os 
import readline 
import rlcompleter 

history = os.path.expanduser('~/.python_history') 
readline.read_history_file(history) 
readline.parse_and_bind('tab: complete') 
atexit.register(readline.write_history_file, history)

EDIT 2:

I deleted my .python_history file and that seems to have fixed the problem. The file was 1914155 lines and around 54mb. I intend to adjust my .pythonrc file so that it will only store a history of a couple hundred lines.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:51:05+00:00Added an answer on June 8, 2026 at 8:51 am

    To fix the problem (hopefully a permanent solution), I added the following line to the .pythonrc.py file.

    import atexit 
    import os 
    import readline 
    import rlcompleter 
    
    history = os.path.expanduser('~/.python_history') 
    readline.read_history_file(history) 
    readline.parse_and_bind('tab: complete')
    # The added line
    readline.set_history_length(200)
    atexit.register(readline.write_history_file, history)
    

    I assume that any sufficiently not stupidly large number will be fine (instead of just 200), but I figure that if I am going more than 200 lines back in my history I am doing something wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Ubuntu 11.10, and I have always run python just fine. However I
One of my Python scripts runs in interactive mode but fails when run from
I have the following python function that allows me to run shell commands from
I'm working on a interactive python shell for an application using Qt. However I
When I start the interactive django shell through manage.py, by executing python -v manage.py
I'm running Python 2.6 on Unix and when I run the interactive prompt (
I have the following code to run python and get the result in scratch
Is it possible for TextMate to run Python scripts in IDLE instead of internally
Is there any free and open-source option to run python from an usb-stick on
I try to use doctest from example from http://docs.python.org/library/doctest.html But when I run python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.