I was trying to process several web pages with BeautifulSoup4 in python 2.7.3 but after every parse the memory usage goes up and up.
This simplified code produces th
Try garbage collecting:
from bs4 import BeautifulSoup import gc def parse(): f = open("index.html", "r") page = BeautifulSoup(f.read(), "lxml") page = None gc.collect() f.close() while True: parse() raw_input()
See also:
Python garbage collection