This project is archived and is in readonly mode.

#1419 ✓resolved
aaronbatalion

MASSIVE memory leak in AssetTag

Reported by aaronbatalion | November 19th, 2008 @ 07:07 PM

Every time you use a asset tag helper referencing a new asset url, references to the controller/template objects are stored in the AssetTag::Cache and never released.

If you render thousands of 3rd party images on your site, each image_tag call creates a hard reference in the AssetTag::Cache, which in turn references the controller/template, not allowing anything created in that request to leave scope, hence you have a massive memory leak.

The objects are cached b/c of filesystem access to determine the modified source string. E.g. "foo" -> "/stylesheets/foo.css"

The attached patch solves the issue by caching only the modified source strings, which is similar to the previous implementation, with a further optimization of caching only asset paths that are relative.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages