Forum Moderators: open

Message Too Old, No Replies

Could be a memory leak?

Could my website increasingly consume resources?

         

Nika

6:19 am on Feb 15, 2005 (gmt 0)

10+ Year Member



I'm working on search engine related optimization of my website which is launched on server already. Naturally I spend a lot of time browsing it and opening this or that page all the time, testing every minor change of code and cetera...

While I'm doing the above I got the feeling that Windows resources seep down much faster than that would happen if I have had doing some other regular thing. For number of times a day my WinXP delivers a Low Memory message and soon after it I have to reboot, otherwise the pc almoust falls asleep.

I'm not any kind of professional in this work. Therefore simple things scare me.

Could it be that my website occupies an incresing amount of memory every time I open a new page of it, due to preloaded images that are preloaded by the "main-frame" page template each time any new page is opened? Or could be there any kind of memory leak at php level due to re-creating objects and variables every time the dynamic page loads? Is there any recommended technique of disposing those objects when shifting the page so that they could be created when needed and disposed at exit of page?

Thanks in advance,

Nick

Jane_Doe

6:41 am on Feb 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Did you check for spyware?

jim_w

6:55 am on Feb 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Since I do not have enough information to answer you question, I will ask a couple of questions.

Are you sure you are not loading new instants of a dll over and over? Have you used task manager to look at the loaded processes?

Yesteryear there was an article in Microsoft System Journal call ‘Programmers, clean up after thyselves”. Are you sure that threads are not getting launched and never ended?

But, yea it could be a memory leak I have a newsbot that develops a memory leak because of their dlls.

rocknbil

6:08 pm on Feb 15, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For number of times a day my WinXP delivers a Low Memory message and soon after it I have to reboot, otherwise the pc almoust falls asleep.

How much RAM? With each new implemenation of Windows, they become more and more consumptive of resources.

I just bought an IBM 2.8 gHz, WXP, and figured 256MB of RAM would be MORE than enough.* I would get the same thing, it was fine, really, until I had several programs open. What happens is it begins to do it's "memory" work on disk, there are hangs and lags . . . .

I put a second 256 chip in it and now it's the fastest machine I've ever owned, all my problems went away.

*Does anyone remember Bill Gates saying, "256K RAM should be enough for ANYONE!"

lZakl

6:17 pm on Feb 15, 2005 (gmt 0)

10+ Year Member



Like rocknbil asked ... How much RAM? Just a bil explained, I had the same exact problem with my test machine running only 256. Put 512 in and problem went away.

Rocknbil, I also remember Mr. Gates saying that nobody will ever fill a 486MB Hard Drive on a home computer too. lol

-- Zak

kaled

1:39 am on Feb 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If the problem is browser related, restarting IE should be sufficient. However, you need to be sure that IE is really closed - you'll need to use the task manager for that.

Assuming that is not the problem, it sounds like a leak in the graphics code of an app. Close everything down one app at a time and you'll probably find it. Start with new or recently updated software.

Also, spyware/virus is a possibility.

Kaled.

Nika

6:23 am on Feb 16, 2005 (gmt 0)

10+ Year Member



Thanks everybody!

This is laptop and RAM is 256. Indeed I'm getting around better on my desktop where RAM is 256+128, much better I would say. Although I don't work with my website there, so what I'm getting around in this instance are the regular disturbances... "Regular" problems are harder at my laptop, but those I recognize.

Sure, checking Task manager all the time and don't see any duplicate threads unless SVCHOST.EXE loaded for jillion times. Number of IE-s in memory accurately correspond to open browser windows - no hijecking or that sort of things so far.

What I'm concerned with, actually, is whether my website - in which I'm digging in all the time continiously optimizing it and phishing "bugs" and mistakes (those I'm producing repeatedly while this job) - this website could stuck the memory up while being serfed by me 3-5 hours each session? The pages are dynamic and are "wrapped" into the same template page, which on its turn has some objects and graphics as preloaded on open - does it mean that this template preloads all the stuff every time I open any new page or the same page all over again? Could that overload the memory after some long period of "persistent torchure" of the pc? Also I heard about such a thing as PHP memory leak - could this be that?

Chiniese say something like: "If stay long enough at the river side You might see the body of your enemy drifting by". If trying hard and long you could overload the memory even leaking smallest portions each time. That's what I mean. And certainly there should be recommended PHP programming techniques that provide with memory caring programming manner - killing threads or freeing graphics from memory on exit of every dynamic page and things like this... Whould be happy to learn about such things.

Thanks,

Nick

grandpa

6:39 am on Feb 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



While you're looking into the memory and related performance, consider this. If you have installed any objects in your web site code that you didn't personally create or verify, you could be doing work that you are not aware of. For example, I use a php class written by someone else. In fact, its a custom error handler. Deep inside the code was a line that invoked an email call, to send error notification to whomever. Without checking the code carefully (kick myself), I began using it and soon thereafter began attempting to send thousands of emails - because I get a lot of errors during development. Fortunately, none of them got sent.

But what I did notice was the sluggish performance that sometimes developed during the course of a day.

rocknbil

6:02 pm on Feb 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



.... - does it mean that this template preloads all the stuff every time I open any new page or the same page all over again? Could that overload the memory after some long period of "persistent torchure" of the pc? Also I heard about such a thing as PHP memory leak - could this be that?

No, and no.

Whatever complexities are going on on your site has nothing to do with how you receive it. It outputs a data stream that is basically plain text (no matter if it's created in perl, php, asp, or a static html page) and shoots it to the browser. The browser stores it in the cache and collects the linked images and objects, done. What you receive on your computer is still a plain text page, no matter what.

A memory leak is something that affects the environment it's run on. If you have a "php memory leak" it's going to affect the server, not your local comp.

Stop what you're doing right now, drive to your nearest Staples and buy a 256 333mhz DDR chip, it will cost you under $100 (I managed to pick a DDR chip for $49, with $20 rebate it was $29!) Shortly thereafter you will jump for joy like all those Toyota, Qwest, and Viagra commercials. :-)

XP is a bit of a RAM hog, esp. on a laptop.

Nika

4:13 pm on Feb 20, 2005 (gmt 0)

10+ Year Member



Many thanks.

tedster

6:35 am on Jun 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



MSDN just published an article about IE and memory leaks that may be of use to folks reading this thread:

[msdn.microsoft.com...]

kaled

9:31 am on Jun 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Adding extra RAM may help but will not solve the problem. I'm using a laptop right now running XP with 128 MB.

Malware it the most likely cause followed by a bug in IE. If there is something unusual about your page such as using javascript to preload images, it is possible you have exposed a bug in IE that has not been noticed before.

Before you splash out money and risk trashing your computer by installing memory (I'm guessing you don't have hardware experience) do the simple things. In this case that means test using other browsers. You should always do this anyway.

Test with Firefox for a day and then Opera for a day. My guess is that it'll be ok. However, these tests may show up faults in your code.

Also make sure your code validates. Invalid code may possibly lead to memory leaks.
[validator.w3.org...]

Kaled.

Arces

11:09 am on Jun 26, 2005 (gmt 0)

10+ Year Member



Hmm... one thing though. Does this same behavior occur on any other websites than the one you're working on? If not, then double check all the javascript (if you used any). Would be also nice if you could test it with a comp with more RAM in it. Never had any problems with websites hogging up all the memory myself though, but I have 1Gb of ram on this comp so that might explain it.