Nicely done, Rich. Fits the facts perfectly. On Sun, Jun 25, 2023 at 2:12 PM [email protected] <[email protected]> wrote:
> Your understanding is correct. As part of my debugging I ran the Seasons > skin and some additional skins. After each template was processed I logged > the number of entries in sys.modules. On the first reporting cycle it > increased by 1 for each template. After that it has not changed. > Belchertown allows the station owner to add custom content via #includes. > The OP was creating this html content every archive and therefore the cache > lookup failed. Since it was html it could be included with the ‘raw’ > directive, skipping the whole Cheetah compilation process. > - rich > > On Sunday, 25 June 2023 at 16:21:55 UTC-4 Tom Keffer wrote: > >> Good sleuthing! Pretty crappy algorithm that allows a cache to grow >> without bounds. >> >> The skins that come with WeeWX (Seasons, Standard) use static source >> template files. They are always the same. So, if I understand you >> correctly, each template should take only one slot in sys.modules. >> >> Does the Belchertown skin do things differently? >> >> -tk >> >> >> On Sun, Jun 25, 2023 at 8:46 AM [email protected] <[email protected]> >> wrote: >> >>> In my experimental skin I was running into this issue, so I decided to >>> delve into Cheetah’s internals and learned the following. As part of the >>> compilation process the module is added to sys.modules and the generated >>> code is cached. If one is dynamically generating template source and it is >>> different, then it will not be found in the cache and an additional entry >>> will be added to sys.modules and the cache. This will result in ever >>> increasing memory usage. Since the OP was dynamically generating html and >>> not Cheetah source, it could be included as ‘raw’. This skips the >>> compilation step and the addition of it to sys.modules and the cache. >>> - rich >>> >>> -- >>> >> You received this message because you are subscribed to the Google Groups >>> "weewx-user" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> >> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/weewx-user/c33494f0-1ff1-464e-b37c-df48f02dc1d3n%40googlegroups.com >>> <https://groups.google.com/d/msgid/weewx-user/c33494f0-1ff1-464e-b37c-df48f02dc1d3n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "weewx-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/weewx-user/f6a401d0-614d-4b7d-b44e-9f58f0870f8en%40googlegroups.com > <https://groups.google.com/d/msgid/weewx-user/f6a401d0-614d-4b7d-b44e-9f58f0870f8en%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEDWK1WyAvpMr3EX2JYpLa-53Nu87nCVJ3hsSbZGRpAweg%40mail.gmail.com.
