I have experienced memory leak issues as well, but only under 32-bit Debian
systems.

About 6 months ago, I tried to isolate the problem, and, like you, came to
the conclusion that it was in the sqlite3 "wrappers." In fact, I came up
with a memory test program that looks very similar to your amemtest.py,
except that it uses the weedb API.

Then, mysteriously, the problem went away with a Debian upgrade. Well,
almost went away. WeeWX still leaks memory, but only a couple megabytes a
week --- something I can live with. The plot below is memory usage over the
last month. Complete series here <http://www.threefools.org/weewx/>
(lower-right
plot).

[image: image.png]

-tk



On Mon, Nov 4, 2019 at 5:53 PM Rich Bell <[email protected]> wrote:

> I'm running on: raspbian stretch, python 2.7.13, and WeeWX 3.9.1.
>
> I was noticing a steady increase in memory usage. I narrowed it down to
> one service I had installed. This service binds to the loop event and makes
> over 10 calls to getSql. I updated the service to open and close the
> connection on each loop event. This seems to have stopped the memory
> increase.
>
> Next, I wrote a small program that does the same steps. Create a
> connection, get a cursor, execute a select, fetchone, close the cursor. But
> this isn't exibiting the memory increase.
>
> Next I wrote a wrapper class for the Connection class and subclassed the
> Cursor class, like WeeWX does. Running with these, I am again seeing the
> memory increase.
>
> I don't see how the 'wrapper' classes should matter... Granted at 10+
> calls per loop, this is aproximately 240 calls a minute - so it would add
> up fast; but I would think others would be seeing something too. I did see
> this thread about the forecast service,
> https://groups.google.com/forum/#!topic/weewx-user/H4GVpoI5l70/discussion
> It looks to make a lot of calls to getSql, but binds to archive, so it
> would happen a lot slower. Not sure if there was any resolution.
>
> I've attached my test program. It can call the sqlite classes directly or
> use the 'wrapper' classes I stole from WeeWx. I may be all wet, but I'm
> seeing something strange in my environment... I'll keep digging.
>
> -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/3753360b-d4c7-44b3-82ca-a8140514b310%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/3753360b-d4c7-44b3-82ca-a8140514b310%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/CAPq0zEBhvdBZhjpDvj%2BUOPf7jYYhi91TcNAZOw9sO1Buq2o-Dw%40mail.gmail.com.

Reply via email to