PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WB18]How do you find a memory leak?
[WB18]How do you find a memory leak?
Iniciado por guest, 10,ene. 2014 04:06 - 18 respuestas
Publicado el 10,enero 2014 - 04:06
I have a website that has a memory leak. 6-10 times per day I must reboot my server due to a memory leak that eats up over 3GB of memory in 1-2 hours each time. The server has 4GB of memory and when first reboot is only using less than 1 GB then within 1-2 hours is maxed out at 3.9GB

We are using Apache for the Web Server & WB18. We are also using classes

I have looked online and there are tools to locate memory leaks for DOT NET but nothing for WD or WB that I have been able to locate.

Any Ideas?

Dan
Publicado el 10,enero 2014 - 10:07
Hi Dan,

Some questions:
0) In task manager (view processes from all user), which processes are consuming the most memory? Are these WebDev related processes?
1) Classic Mode <-> AWP Mode?
2) HC Classic <-> HFCS or other DB?
3) Session timeout settings on webdev server?
4) Do you clear your queries after having usage/lifecycle in your apps/classes ?(hFreeQuery)
5) ...

Cheers,

Peter H.
Publicado el 10,enero 2014 - 13:17
Hi Dan

on top of Peter's excellent questions, are you able to reproduce the problem on a test server? If yes, this gives you a great way to isolate the problem by checking out the memory usage while YOURSELF doing different operations on the web site

Best regards
Publicado el 10,enero 2014 - 16:53
Hi All,

I have a question related to Peter's answer. Is there a substantive difference between "hCancelDeclaration" and "hFreeQuery"?

I have been using "hCancelDeclaration" after I am finished with Queries. Is that sufficient?

Thanks!
Publicado el 10,enero 2014 - 17:05
Not sure anyone on here knows

hFreeQuery appeared pretty much unannounced in v16

I now use this in preference on the assumption that PCS must have provided this alternative for some good reason.
Publicado el 10,enero 2014 - 17:43
I rebooted server at 11pm then memory was down to 1.03. When I woke up this morning this what I see ...

Services : http://screencast.com/t/tUHp93zJ
Processes : http://screencast.com/t/agtE29KT

After Reboot
Services : http://screencast.com/t/UWtb6qYjz
Processes : http://screencast.com/t/0GQIZq9ZTIo


Pete, Please see below ...

Some questions:
0) In task manager (view processes from all user), which processes are consuming the most memory? Are these WebDev related processes? .... http://screencast.com/t/tUHp93zJ
1) Classic Mode <-> AWP Mode? ...................... AWP Mode
2) HC Classic <-> HFCS or other DB? ................. HFCS (located on the same server as the website
3) Session timeout settings on webdev server? ........Do you mean "Disconnect the idle users since? http://screencast.com/t/ZudBsqnhSn6u
4) Do you clear your queries after having usage/lifecycle in your apps/classes ?(hFreeQuery)

Not sure, I did not build this site, I had it built for me. The site is using SQL statements & classes (no Queries) so I do not know how to determine. Is "clear your queries" only if you use queries or does it apply to SQL statements which are used with classes.

Also ... could the classes or Objects built from the classes be eating up the memory ... if they are not being released?

5) ...
Publicado el 10,enero 2014 - 18:23
Hi Dan,

Weird, according to your screenprints you have about:
- 60Mb on HyperFileCS memory usage
- 20Mb on WDSession.exe memory usage

So I'm not sure where all the GB's are being used by. At first sight it surely ain't WebDev...

Are you sure you clicked the "View processes from all users" in the task manager?

On the other hand, there's an anomaly in your anwser I think.
If the site is fully AWP, then for each request you should see a WDSession.exe for the time of generating the page and providing it to the browser. Next it should dissapear. So I think it is classic mode and you had 4 sessions in your exemple...

You'll need some more research...
If you have teamviewer I might have a look together with you.
Send me a pm in that case.

Cheers,

Peter H.
Publicado el 10,enero 2014 - 18:35
Hi everybody

hcanceldeclaration and hfreequery are EXACTLY the same function. The new name was just added to be more explicit

Best regards
Publicado el 10,enero 2014 - 18:39
Hi Dan

you need to click on the resource monitor button to have more information about the memory usage (even possibly use the systinternal utilities to have even more detailed information)

About the queries, you have to check that after each hexecuteQuery (or equivalent) there is a corresponding hcanceldeclaration

But I agree with Peter, your screenshots do NOT show the whole picture

Best regards
Publicado el 10,enero 2014 - 19:09
Peter, I just sent Teamviewer details to you on Skype
Publicado el 10,enero 2014 - 19:38
It is displaying all users ... http://screencast.com/t/jd8232REYH7j

And here is the performance : http://screencast.com/t/o0mzpsrYT

Memory is back up to 70% after rebooting just 1 hour ago


Manta.exe after reboot starts at about 21,000K then overtime it never gets lower only rises until I run out of memory ... http://screencast.com/t/gs7Yy83sUOxa

and in less than 1 hour I have over 3.00GB of memory locked up (and never frees up) ... http://screencast.com/t/Yx8ZIKSeY

Here is what is happening on the WebDev Admin ... http://screencast.com/t/RHPEPH8YdSMm

This is the activity on the web ... http://screencast.com/t/VRAesSiLTC7
Publicado el 12,enero 2014 - 10:57
Hi Dan,

Sorry, just noticing your Skype message now. Sent you a pm...

Cheers,

P.
Publicado el 05,junio 2014 - 10:31
I just upgraded to v19 from v16. I am seeing a major memory leak problem. The exact same application, just compiled in v19, quickly increases to consume all the server memory. The application is simply running a Procedure on a timer every few minutes and then write to some files based on changes done on a web portal. There are long periods where there is nothing for it to do (no changes on the web portal), but still leaks memory.

What changed in v19 that would cause this? I have been pretty good about using HFreeQry. Even if I am missing a few, why would it all of the sudden be an issue in v19 when it wasn't in v16?
Publicado el 05,junio 2014 - 10:33
I forgot to mention that the memory leak stays even if I close the application.

The memory utilization is not always evident in the resource monitor. You won't always see it in the Processes as being that high. If I look deeper, I can sometimes see that the combination of Commit, Write, and Private together is high; but not always.

If I kill the Manta process, the memory then frees up until I run the app again and the leaks start.
Miembro registrado
6 mensajes
Publicado el 16,diciembre 2020 - 09:46
Stephen, did you ever get to the bottom of your memory leak. We have the same issue in v23 and can't figure it out!

Thanks

Chris
Miembro registrado
14 mensajes
Publicado el 19,diciembre 2020 - 07:35
Hi friends,

I recommend just to switch HFSQL C/S to version 25. If that doesn't help then you have to upgrade your application as well but I do not think that would be necessary.

--
Gunter Predl
paypal@windev.at
Miembro registrado
31 mensajes
Publicado el 20,diciembre 2020 - 00:05
So most of my programs are in WinDev22. Are you saying that I can just download HFSQL Server 25 and install it and all my apps will still work?
Thanks,
Garry

--
Garry
Miembro registrado
14 mensajes
Publicado el 21,diciembre 2020 - 16:44
Yes.

--
Gunter Predl
paypal@windev.at
Miembro registrado
6 mensajes
Publicado el 21,diciembre 2020 - 21:07
You need to change the framework, and all this problems will be gone. Promise