Welcome! Log In Create A New Profile

Advanced

WebDev Session Memory Usage

Posted by MediOffice 
WebDev Session Memory Usage
May 25, 2022 11:03AM
Using WB25. Quite a large app. I'm finding as I use the application the memory usage for the session on the server keeps increasing - starts at about 20MB and over time exceeds 100MB.

A typical example:
I use classes to load the data from a sql query into a class data array.
I create an instance of the class on a page and call the load method and display the data in a looper linked to the data array.
All works really well.

My classes used to be GLOBAL (I wasn't using them properly) and I thought this was the issue - but now they are all non-global and the memory usage is exactly the same.

I do exactly the same test with a small dataset and a large dataset. With the large dataset the memory goes up more between pages. Which strongly suggests to me that the memory allocated to the classes is not being freed up after the user navigates to another page.

Can anybody suggest what I'm doing wrong?
Re: WebDev Session Memory Usage
May 25, 2022 01:03PM
Do you clear the query memory after loading?

[infosonline.net]
Re: WebDev Session Memory Usage
May 25, 2022 01:46PM
Yes, I've just put HFreeQuery statements after the query results have been copied to the array - also made no difference.
pao
Re: WebDev Session Memory Usage
May 25, 2022 02:37PM
I don't know if it helps but you can try to close the context of the previous page to free resources.

Try something like:
ContextClose(PreviousPage())

Other option to test is to delete the array when leaving the page.

Regards

Paulo Oliveira



Edited 1 time(s). Last edit at 05/25/2022 02:37PM by pao.
Re: WebDev Session Memory Usage
May 25, 2022 03:11PM
Thanks Pao!

That made a huge difference.

I put ContextClose(PreviousPage()) as the first line of several of my pages that I'm using for the test and it reduced the memory growth considerably!!!

That's really good!
pao
Re: WebDev Session Memory Usage
May 25, 2022 05:06PM
Be very careful with this and test in depth, it can cause other problems such as if you try to use the browser's back button or if on a page you refer to controls from another page

Regards

Paulo Oliveira
Re: WebDev Session Memory Usage
May 27, 2022 05:23PM
Thanks Pao.

My pages are setup with back button forbidden. However if they press the back button then they get a session error and the session is closed. I can configure the error - but it's not very elegant. Is there a better way to trap and handle this?

I have inserted ContextClose(PreviousPage()) as the first line now of all my pages. I do have a few areas where this is a problem.

If I'm on PAGE_Patients and the user presses the menu button that opens the same page again then I have a problem. Is there a better way to do this or a better place to put the code?
Re: WebDev Session Memory Usage
May 29, 2022 10:10PM
Hi,

PageUse instead of PageDisplay closes all contexts before opening the next page.

Regards,
Piet
Re: WebDev Session Memory Usage
May 30, 2022 03:08PM
Thanks Piet, that makes an even bigger improvement and everything works really well now! Using much less memory.

The only thing I would really like to tidy up is what happens when the user presses the browser back key. Is there any way I can intercept this within my page and either simply ignore it or popup a message - but importantly keep on the same page?
Re: WebDev Session Memory Usage
May 31, 2022 12:12AM
Hi

Disallow the Browser back button in the PAGE description. Can do project wide via the Project options too.

Rgds
Paul
Re: WebDev Session Memory Usage
May 31, 2022 07:32PM
It is disabled
Re: WebDev Session Memory Usage
June 01, 2022 02:44AM
Hi

Do you mean the option to Disallow the Back button is disabled in the Description Page, or do you already have it switched off?

If I remember correctly, the Project option to disallow the back button only applies when you create a new page. Existing Pages aren't changed, so they have to be switched off individually.

Anyway one of my sites uses that feature, and the back button doesn't work, so it seems to work as described.

Rgds
Paul
Re: WebDev Session Memory Usage
June 01, 2022 07:50AM
Just tested this - and the 'Forbidden' option in a PAGE Description no longer seems to have any effect!!

Looks like a bug in WB27...

Rgds
Paul
Re: WebDev Session Memory Usage
July 12, 2022 12:53PM
Hi Piet

Unfortunately I've had to revert most of the calls back to PageDisplay. I was getting page context issue. Sometimes users double click buttons which execute a PageUse and that causes issues.

So what I've done is all my page opens from the main menu are PageUse but anything else is a PageDisplay. So from time to time when they choose a main menu item it kinda, hopefully, releases some memory. It's better than everything with PageDisplay but not as good as with PageUse.

Piet, did you have this problem (context) and if so what have you done about it?

G
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: