PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD22] Windows services consumes a lot of memory when idle over the time
[WD22] Windows services consumes a lot of memory when idle over the time
Iniciado por guest, 12,abr. 2018 17:36 - 5 respuestas
Publicado el 12,abril 2018 - 17:36
HI,

I have created a couple of windows services (windows 2012R2). Most of the time they do nothing, but the memory consumption growths over the time from 3 MB to 100 MB after 3 hours. I have no idea why.

I have a table "input" with a boolan field "done"

The main code is only:

hopenconnection(ccc)
for all input where done=false
.....
.......
end
hcloseconnection(ccc)

Any Ideas ?
Publicado el 13,abril 2018 - 08:46
Hi Michael,

this smells (reeks) like a "memory leak". Which version is it? v21? Yesterday, I got a complaint about a similar problem with a WINDEV application constantly serving about 100 users by day and night. After some heavy reporting the server is kind of blown up with more than 100 gb in use. So, imho this one refers to HFSQL C/S v21.

In principle - just in case, the suspect is HFSQL too - you could switch to HFSQL v23 which is already available on the French site of PC Soft.
Publicado el 13,abril 2018 - 08:53
Hi Guenter,

no is V22.

After some tests it looks like

For each input where done=false

run smoother then

hreadfirst / hreadnext / do while not hout()

which I used first.

To be continued ...
Publicado el 13,abril 2018 - 09:34
Hi Michael,

can you replace the highly suspect "FOR EACH .." loop with a WHILE .. WEND or a FOR .. TO ... END loop? and look at the resulting behaviour?
Publicado el 13,abril 2018 - 11:21
Hi,

I have read on the french forums that some people solved what looked like memory leaks in HFCS by unchecking the automatic statistics calculations in it.

Let us know if that helps here

Best regards
Publicado el 15,abril 2018 - 10:29
Hi Fabrice,

disable the automatic statistics was not sucessfull.

You gave me a year ago a code snippet :

PROCEDURE Free_Memory()


LOCAL
nHdl is system int = 0
IF SysWindowsVersion() _IN_ ("NT 3.5","NT 4","NT 5","XP","2003S","VISTA","7","10","2012S","2016S") THEN
nHdl = API("KERNEL32","GetCurrentProcess")
API("KERNEL32","SetProcessWorkingSetSize",nHdl,-1,-1)
END

this holds the memory consumption for the service at 0.4 MB over the time, which is was I expect for a idle process.
For the moment I can´t overlook which side effects this has ... but I keep you informed.