On Thu, Feb 21, 2013 at 08:05:54AM -0800, Simon King wrote: > While reading the source, I noticed the documentation for > pyramid.traversal.quote_path_segment which says: > > The return value for each segment passed to this > function is cached in a module-scope dictionary for > speed: the cached version is returned when possible > rather than recomputing the quoted version. No cache > emptying is ever done for the lifetime of an > application, however. If you pass arbitrary > user-supplied strings to this function (as opposed to > some bounded set of values from a 'working set' known to > your application), it may become a memory leak. > > > https://github.com/Pylons/pyramid/blob/1.4/pyramid/traversal.py#L549 > > > As far as I can tell, if you are generating URLs based on strings from a > database, whether with traversal or url dispatch, that cache will end up > containing every string from your database that ever gets used during URL > generation.
This is what it looks like on a server I manage: >>> len(pyramid.traversal._segment_cache) 110943 Looks big, but the total memory used is modest, only around 19 MB according to sys.getsizeof. You would need a pretty big database for it to be a problem. -- Brian Sutherland -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscr...@googlegroups.com. To post to this group, send email to pylons-discuss@googlegroups.com. Visit this group at http://groups.google.com/group/pylons-discuss?hl=en. For more options, visit https://groups.google.com/groups/opt_out.