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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:40:18+00:00 2026-06-12T04:40:18+00:00

I have a complicated python server app, that runs constantly all the time. Below

  • 0

I have a complicated python server app, that runs constantly all the time. Below is a very simplified version of it.

When I run the below app using python; “python Main.py”. It uses 8mb of ram straight away, and stays at 8mb of ram, as it should.

When I run it using pypy “pypy Main.py”. It begins by using 22mb of ram and over time the ram usage grows. After a 30 seconds its at 50mb, after an hour its at 60mb.

If I change the “b.something()” to be “pass” it doesn’t gobble up memory like that.

I’m using pypy 1.9 on OSX 10.7.4
I’m okay with pypy using more ram than python.

Is there a way to stop pypy from eating up memory over long periods of time?

import sys
import time
import traceback

class Box(object):
    def __init__(self):
        self.counter = 0
    def something(self):
        self.counter += 1
        if self.counter > 100:
            self.counter = 0

try:
    print 'starting...'
    boxes = []      
    for i in range(10000):
        boxes.append(Box())
    print 'running!'
    while True:
        for b in boxes:
            b.something()
        time.sleep(0.02)

except KeyboardInterrupt:
    print ''
    print '####################################'
    print 'KeyboardInterrupt Exception'
    sys.exit(1)

except Exception as e:
    print ''
    print '####################################'
    print 'Main Level Exception: %s' % e
    print traceback.format_exc()
    sys.exit(1)

Below is a list of times and the ram usage at that time (I left it running over night).

Wed Sep  5 22:57:54 2012, 22mb ram 
Wed Sep  5 22:57:54 2012, 23mb ram 
Wed Sep  5 22:57:56 2012, 24mb ram 
Wed Sep  5 22:57:56 2012, 25mb ram 
Wed Sep  5 22:57:58 2012, 26mb ram 
Wed Sep  5 22:57:58 2012, 27mb ram 
Wed Sep  5 22:57:59 2012, 29mb ram 
Wed Sep  5 22:57:59 2012, 30mb ram 
Wed Sep  5 22:58:00 2012, 31mb ram 
Wed Sep  5 22:58:02 2012, 32mb ram 
Wed Sep  5 22:58:03 2012, 33mb ram 
Wed Sep  5 22:58:05 2012, 34mb ram 
Wed Sep  5 22:58:08 2012, 35mb ram 
Wed Sep  5 22:58:10 2012, 36mb ram 
Wed Sep  5 22:58:12 2012, 38mb ram 
Wed Sep  5 22:58:13 2012, 39mb ram 
Wed Sep  5 22:58:16 2012, 40mb ram 
Wed Sep  5 22:58:19 2012, 41mb ram 
Wed Sep  5 22:58:21 2012, 42mb ram 
Wed Sep  5 22:58:23 2012, 43mb ram 
Wed Sep  5 22:58:26 2012, 44mb ram 
Wed Sep  5 22:58:28 2012, 45mb ram 
Wed Sep  5 22:58:31 2012, 46mb ram 
Wed Sep  5 22:58:33 2012, 47mb ram 
Wed Sep  5 22:58:35 2012, 49mb ram 
Wed Sep  5 22:58:35 2012, 50mb ram 
Wed Sep  5 22:58:36 2012, 51mb ram 
Wed Sep  5 22:58:36 2012, 52mb ram 
Wed Sep  5 22:58:37 2012, 54mb ram 
Wed Sep  5 22:59:41 2012, 55mb ram 
Wed Sep  5 22:59:45 2012, 56mb ram 
Wed Sep  5 22:59:45 2012, 57mb ram 
Wed Sep  5 23:00:58 2012, 58mb ram 
Wed Sep  5 23:02:20 2012, 59mb ram 
Wed Sep  5 23:02:20 2012, 60mb ram 
Wed Sep  5 23:02:27 2012, 61mb ram 
Thu Sep  6 00:18:00 2012, 62mb ram 
  • 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-12T04:40:20+00:00Added an answer on June 12, 2026 at 4:40 am

    http://doc.pypy.org/en/latest/gc_info.html#minimark-environment-variables shows how to tweak the gc

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

Sidebar

Related Questions

Im having a very strange problem, i have a complicated view that returns incorrect
I have a pretty complicated python program. Internally it has a logging system that
I'm new to python, django and google app engine. All great tools and have
Python 3 really complicated the whole file reading process, when you have a binary
I have a complicated MySQL query which takes a lot of time, selecting from
I have a complicated report that I need to draw with GDI+ (I don't
I have this complicated slider that utilizes tons of animation. I'm trying to find
I have a complicated nested form (Ryan Bates' version) with .live() attached to some
My Python server receives jobs that contain a list of the items to act
Working in Python 2.7. I have two different lists, A and B (simplified to

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.