[Lazarus] SQLDBRestBridge memory consumption attn Michael
Michael Van Canneyt
michael at freepascal.org
Mon Dec 27 12:00:44 CET 2021
On Mon, 27 Dec 2021, zeljko wrote:
> Hi all,
>
> fpc-3.2.2, lazarus trunk...found that sqldbrestdispatcher does not free some
> unused resources, so sqldbrestserver memory alloc grows and after few
> thousand connections eats more than 1GB of memory.
> Just found in TSQLDBRestDispatcher.HandleResourceRequest that
> H: TSQLDBRestDBHandler is created for each request but freed when dispatcher
> is destroyed. So, dispatcher in this case can contain thousands of
> TSQLDBRestDBHandler unused components (could not find that dispatcher reuse
> any of this).
> I've added H.Free at last place in finally section and it seem that memory
> does not grow too much at all (still grows but slower, probably there's still
> unused resources around). Solution would be to reuse TSQLDBRestDBHandler's or
> free them. Pls look at
> https://forum.lazarus.freepascal.org/index.php/topic,51938.msg382021.html#msg382021
Forum is down, but I distinctly remember fixing this memleak.
It was not on my main development machine, but in a Windows VM.
Probably I forgot to commit that at the time :/
I applied a fix (free the handler), and fixed some compiler hints/warnings as well.
I did a test, and I can't reproduce memleaks with the current demo
application (the -m option exists for this very purpose), but that
doesn't mean there are no memleaks left, there are many different execution paths :/
Michael.
More information about the lazarus
mailing list