Loading/unloading pages

not sure I’ve worded this very well, but …
my webapp has about a dozen webpages which are connected via buttons which, when clicked, call the .Show method for the required new page. If I’m jumping around a lot is there anything I should be taking care of with regard to closing the windows and freeing memory? I currently don’t do anything except call the show method for the new window.

The pages are fairly self contained, loading info from tables when shown & doing any manipulation and saving of that data as required. When I leave the page it’s to go to another section so nothing is required of the recently departed page.

Is there a best practice for this? I can’t seem to find anything in the docs.


The first thing to do is look at your memory footprint with the anticipated session load on the app and decide if it’s really a problem on the server side. If you can connect 50 users up and it’s using say 100MB of RAM on the server, and you have 300MB RAM available, and only expect 20 users at a time, AND you don’t see any memory leak behavior that you need to track down, just let it be :-). Benchmark so you can tell if you have a problem to solve first.

Now, if it’s a problem… First thing you need to do is stop using implicit instances of pages. It’s a “beginner” feature. Instead, keep explicit properties for each page in your Session class, and access them explicitly. Don’t retain references beyond local code scopes. Have the Session close the pages and release its references as needed.

A side benefit of staying away from implicit instances is that you’ll also stay away from various Session global issues that don’t quite work right from release to release. Search for “WebSessionContext” in the forums. Another thing you can do about the Session issue is just manage it yourself. I have code as partof a for-sale product that does this. You can read about what it does here:


Thanks for that.
Just found some docs that say the same.