Connecting Tech Pros Worldwide Help | Site Map

How much memory does my script use?

  #1  
Old August 23rd, 2007, 06:55 AM
FFMG
Guest
 
Posts: n/a

Hi,

My Hosting company is saying that I am using too much memory on the VPS
and that I should upgrade.

I am currently running at 65%-75%, (according to WHM).

It does seem a bit high, but I cannot see what could be using a lot of
memory. I have MySQL 5 and and php 4.4.
Is there any PHP code that I could use to 'check' how much memory a
script is using to run so that I could flag the problem ones?

How would you identify what process is taking large amount of memory?

FFMG


--

'webmaster forum' (http://www.httppoint.com) | 'Free Blogs'
(http://www.journalhome.com/) | 'webmaster Directory'
(http://www.webhostshunter.com/)
'Recreation Vehicle insurance'
(http://www.insurance-owl.com/other/car_rec.php) | 'Free URL
redirection service' (http://urlkick.com/)
------------------------------------------------------------------------
FFMG's Profile: http://www.httppoint.com/member.php?userid=580
View this thread: http://www.httppoint.com/showthread.php?t=19636

Message Posted via the webmaster forum http://www.httppoint.com, (Ad revenue sharing).

  #2  
Old August 23rd, 2007, 10:35 AM
Erwin Moller
Guest
 
Posts: n/a

re: How much memory does my script use?


FFMG wrote:
Quote:
Hi,
>
My Hosting company is saying that I am using too much memory on the VPS
and that I should upgrade.
>
I am currently running at 65%-75%, (according to WHM).
>
It does seem a bit high, but I cannot see what could be using a lot of
memory. I have MySQL 5 and and php 4.4.
Is there any PHP code that I could use to 'check' how much memory a
script is using to run so that I could flag the problem ones?
>
How would you identify what process is taking large amount of memory?
>
FFMG
>
>
Hi,

Have a look at memory_get_usage() at php.net.
You could try to use it to get an idea of what parts of your script take
up what amount of memory.
Just place it at strategically placed points in your script, like before
calling a heavy function, and during the function, and when it returns.
Since we don't know your script, you'll have to identify the subject
actions in the script yourself.

Hope that helps.
Good luck.

Regards,
Erwin Moller

PS: Tip: If you have a question like this, first go to www.php.net and
type it in the searchfield. (If you type 'memory' there you find this
function.)
  #3  
Old August 23rd, 2007, 02:05 PM
Jerry Stuckle
Guest
 
Posts: n/a

re: How much memory does my script use?


FFMG wrote:
Quote:
Hi,
>
My Hosting company is saying that I am using too much memory on the VPS
and that I should upgrade.
>
I am currently running at 65%-75%, (according to WHM).
>
It does seem a bit high, but I cannot see what could be using a lot of
memory. I have MySQL 5 and and php 4.4.
Is there any PHP code that I could use to 'check' how much memory a
script is using to run so that I could flag the problem ones?
>
How would you identify what process is taking large amount of memory?
>
FFMG
>
>
Are you talking about real memory or virtual memory? How much of each
do you have? And is it PHP and/or MySQL using the memory or something
else? Is this average or peak?

What are you doing in your scripts which might be memory intensive? I.e.
are you using large arrays? Graphic manipulation? Reading large files
into memory? Something else?

I regularly run 75%+ of real memory on my VPS's and they runs fine. But
I also have the systems tuned to run that way.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  #4  
Old August 23rd, 2007, 03:35 PM
FFMG
Guest
 
Posts: n/a

re: How much memory does my script use?



Jerry Stuckle;88408 Wrote:
Quote:
>
Are you talking about real memory or virtual memory? How much of each
do you have? And is it PHP and/or MySQL using the memory or something
else? Is this average or peak?
>
What are you doing in your scripts which might be memory intensive?
I.e.
are you using large arrays? Graphic manipulation? Reading large
files
into memory? Something else?
>
I regularly run 75%+ of real memory on my VPS's and they runs fine.
But
I also have the systems tuned to run that way.
>
Well, everything runs fine except for the WHM updates, every nights it
tries to update the system but for the life of me I cannot see what
could take so much memory, (maybe the unpacking?).

I am a windows user but my VPS is unix, so I am not sure if I am using
Virtual or real memory. And if I should allocate virtual memory or
not.
I am guessing that if I could allocate some virtual memory then the WHM
updates could run without a hitch.

The reason I ask is, last week the system went down and since then the
Hosting co is saying that it was my fault, (but I had changed nothing
in my scripts).
After complaining that they had screwed up the system and not me they
are now saying that I am using too much memory and the Updates are
crashing every morning.

I have disabled the updates for now, but i need to resolve the issue.

What are the unix commands to
- Get the virtual memory
- Get the real memory
- Set the virtual memory, (and what do you suggest it should be?)

Thanks

FFMG


--

'webmaster forum' (http://www.httppoint.com) | 'Free Blogs'
(http://www.journalhome.com/) | 'webmaster Directory'
(http://www.webhostshunter.com/)
'Recreation Vehicle insurance'
(http://www.insurance-owl.com/other/car_rec.php) | 'Free URL
redirection service' (http://urlkick.com/)
------------------------------------------------------------------------
FFMG's Profile: http://www.httppoint.com/member.php?userid=580
View this thread: http://www.httppoint.com/showthread.php?t=19636

Message Posted via the webmaster forum http://www.httppoint.com, (Ad revenue sharing).

  #5  
Old August 23rd, 2007, 04:55 PM
Jerry Stuckle
Guest
 
Posts: n/a

re: How much memory does my script use?


FFMG wrote:
Quote:
Jerry Stuckle;88408 Wrote:
Quote:
>Are you talking about real memory or virtual memory? How much of each
>do you have? And is it PHP and/or MySQL using the memory or something
>else? Is this average or peak?
>>
>What are you doing in your scripts which might be memory intensive?
>I.e.
>are you using large arrays? Graphic manipulation? Reading large
>files
>into memory? Something else?
>>
>I regularly run 75%+ of real memory on my VPS's and they runs fine.
>But
>I also have the systems tuned to run that way.
>>
>
Well, everything runs fine except for the WHM updates, every nights it
tries to update the system but for the life of me I cannot see what
could take so much memory, (maybe the unpacking?).
>
I am a windows user but my VPS is unix, so I am not sure if I am using
Virtual or real memory. And if I should allocate virtual memory or
not.
I am guessing that if I could allocate some virtual memory then the WHM
updates could run without a hitch.
>
The reason I ask is, last week the system went down and since then the
Hosting co is saying that it was my fault, (but I had changed nothing
in my scripts).
After complaining that they had screwed up the system and not me they
are now saying that I am using too much memory and the Updates are
crashing every morning.
>
I have disabled the updates for now, but i need to resolve the issue.
>
What are the unix commands to
- Get the virtual memory
- Get the real memory
- Set the virtual memory, (and what do you suggest it should be?)
>
Thanks
>
FFMG
>
>
You need to ask these questions in a Unix/Linux admin group.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Make a File Download Script with Perl KevinADC insights 1 December 4th, 2008 06:44 AM
Storing file information in memory deciacco answers 10 November 16th, 2007 10:55 PM
Reducing memory consumption Bruno Barberi Gnecco answers 9 April 25th, 2007 01:15 AM
releasing memory to malloc iker.arizmendi@gmail.com answers 12 October 5th, 2006 11:05 AM