Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Memory leak?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
monk.e.boy  
View profile  
 More options Dec 19 2007, 9:21 am
From: "monk.e.boy" <jo...@neutralize.com>
Date: Wed, 19 Dec 2007 06:21:22 -0800 (PST)
Local: Wed, Dec 19 2007 9:21 am
Subject: Re: Memory leak?
I have done a nice simple test file (see end of post) when I run this
against my test HTML page using Windows XP I can watch the amount of
memory go up by about 2,000 K for each page loaded. So I load this in
IDLE:

13,584K
run the python
30,548K
run the python
45,608K
run the python
60,515K

So there is my proof. I can't see that it is anything apart from BS
that is leaking. How can I find the leaks and more importantly, if I
do find the leaks will anyone apply the patches?

Here is the test code:

import sys

if __name__ == "__main__":
        # hack to get beautiful soup imported
        sys.path.append("C:\\py")

from BeautifulSoup import BeautifulSoup
from BeautifulSoup import NavigableString
import urllib2

url = 'http://dev/mem-1.html'

def soup(html):
        soup = BeautifulSoup(html)

        for css in soup('link'):
                found = False
                for c in css.attrs:
                        if c[0]=='rel' and c[1]=='stylesheet':
                                found = True
                if found:
                        print 'css: '+str( css )

def go(url):
        request = urllib2.Request(url)
        request.add_header( 'Accept', 'text/html' )
        opener = urllib2.build_opener()
        f = opener.open(request)
        soup(f.read())
        del f

for x in range(15):
        print x
        go(url)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.