Welcome, guest | Sign In | My Account | Store | Cart

My company wrote an application server that works as a long running service. We were confronted with a memory usage that we couldn't explain until we found out, that the re module is caching a lot of data in the background.

Python, 1 line
1
re.purge()

The function re.purge() empties the internal cache of the re module. This will help to get some memory back in long running processes ;-)

1 comment

Nikos Kouremenos 16 years ago  # | flag

nice! sre docs suck, thanks for this one :)

Created by Dirk Holtwick on Sun, 27 Nov 2005 (PSF)
Python recipes (4591)
Dirk Holtwick's recipes (15)

Required Modules

  • (none specified)

Other Information and Tasks