473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Shouldn't all memory be freed after a page load?

Sporadically, I am receiving "out of memory" errors on my websites. In my performance monitor (Debug Diagnostic Tool), I can watch virtual bytes skyrocket until it causes an "out of memory" error on my website.

What could be causing this? Even if I have piss-poor code with plenty of unclosed, un-nothing'ed objects, shouldn't the memory be freed after the page is served to the user? That is, nothing should be persisted from one page visit to another page visit. I am using no session variables.

Forgive me if this belongs in a forum about servers. Perhaps I'll try my luck there as well.
Feb 19 '10 #1
3 1962
jhardman
3,406 Expert 2GB
That's a good question, and the answer depends on if your question starts with "should" or "will". Should all the memory be freed? yes. Will it? no.

You still need to close your objects just to be on the safe side.

Jared
Feb 23 '10 #2
Thanks for the reply.

I'm a little uneasy about your "be on the safe side" comment. I'm aware that closing all objects (and writing more efficient code overall) wouldn't HURT the memory usage, in fact it would help.

But I want to know if and why memory is persisted from one page load to another (and seemingly kept on some sort of memory stack, according to IIS debug diagnostic tool's report of virtual/private bytes used).

Broadly, here is how I would imagine a server works:
-Incoming request for a page "index.asp"
-Ok, "index.asp" will require 50mb of memory usage. Server serves the page, disconnects with the requestor for "index.asp" and can then completely forget about that page request. free all memory. act like it never happened.

kind of like how you can open up a program (it will be using RAM), and then you can close the program and free the RAM.
Feb 23 '10 #3
jhardman
3,406 Expert 2GB
But your program (IIS) never shuts down and it is IIS that creates the server objects, not the script that is calling them. Does that make sense? As far as I know it is the server objects that you need to worry about leaking, so every time you say server.createobject you will need to destroy it.

I'm far from a computer science theoretician, so I could be way wrong. I once told someone, "no, everything will close down by itself" and I got called on it. I personally have written my share of bad, sloppy, and unclosed code, and it rarely comes back to haunt me, I'm just trying to tell you how I understand things.

Jared
Feb 23 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Birgit Rahm | last post by:
Hello newsgroup, I am a beginner, so I am asking maybe immoderate questions. I want to delete a variable, after filling it with complex objects. How should I do it? e.g. AAA = AAA = Can I...
25
by: MC | last post by:
Hi I have the following piece of code. int *p; p = malloc(10); int *j; j = p; free(p); Is this legal ? will j still point to the same
13
by: Michael B Allen | last post by:
Hi, I've tried to write the *simplest* memory allocator possible. I think it would be useful in many cases such as allocating memory on stack as a poor man's garbage collection perhaps. I was...
25
by: Zeng | last post by:
I finally narrowed down my code to this situation, quite a few (not all) of my CMyClass objects got hold up after each run of this function via the simple webpage that shows NumberEd editbox. My...
8
by: TheB | last post by:
Ok, lets try this again. I have a program which searches all disk drives for certain file types. When it finds a file it writes a record to a Firebird DB. The program normally is using 40 - 44...
5
by: Versteijn | last post by:
Hello all I have a ASPX file called scaleimage.aspx that scales my images down to a given width. This page is used very much in web project I am working on. But due to the large size of the...
7
by: Rich Denis | last post by:
Hello, I have been trying to solve a mysterious memory leak problem and was hoping that you could help me out on my stuck point. First a bit of background. We have two app servers in an app...
8
by: Adrian | last post by:
Hi I have a JS program that runs localy (under IE6 only) on a PC but it has a memory leak (probably the known MS one!) What applications are there that I could use to look at the memory usage of...
9
by: Bruno Barberi Gnecco | last post by:
I'm using PHP to run a CLI application. It's a script run by cron that parses some HTML files (with DOM XML), and I ended up using PHP to integrate with the rest of the code that already runs the...
26
by: Ravindra.B | last post by:
I have declared a global variable which is array of pointers and allocated memory for each array variable by using malloc. Some thing similar to below... static char *arr; main() { int i;
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.