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 5927839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:13:30+00:00 2026-05-22T14:13:30+00:00

It would appear that ipython may be retaining references to objects when I’m not

  • 0

It would appear that ipython may be retaining references to objects when I’m not expecting it to.

Consider the following script (grc.py):

import sys
obj = []
print sys.getrefcount(obj)

When I run it in ipython:

Python 2.7.1 |EPD 7.0-2 (64-bit)| (r271:86832, Nov 29 2010, 13:51:37)

In [1]: %run grc.py
2

In [2]: print sys.getrefcount(obj)
4

What’s going on? Where did the extra two references come from?

  • 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-05-22T14:13:31+00:00Added an answer on May 22, 2026 at 2:13 pm

    Yes, IPython does maintain references to objects behind the scenes. Using %run in particular leaves references in the machinery that handles modules.

    We’re working on it in the development version (which will hopefully become 0.11 soon) – see this issue for more information. The references will still be there, but there’ll be ways to get rid of them (%reset to clear them all, or %xdel obj for a single one).

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

Sidebar

Related Questions

It would appear that ajaxStart in my MVC 3 project is working but not
Been hunting for an hour or so. It would appear that db.Float does not
It would appear that I am suffering from a new bug in IE7, as
I am a newbie working towards developing an IE extension that would appear as
I would like that the Index action doesn't appear in the url. For example,
It would appear that catching an error is slower that performing a check prior
It would appear that the functionality to add shortcut keys in SSMS2008 is mostly
It would appear that installing Xcode 4.2 on my Mac OS X 10.6 machine
When I create a user control in WPF it would appear that all the
If I follow decoupling all the way, it would appear that DataAccess layer should

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.