Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8786321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:35:29+00:00 2026-06-13T21:35:29+00:00

I just noticed – by calling memory_get_peak_usage() on an ’empty’ php file, using php-fastcgi

  • 0

I just noticed – by calling memory_get_peak_usage() on an ’empty’ php file, using php-fastcgi and NGINX, the result is ~120KB of memory

<?php

    print_r(memory_get_peak_usage());

?>

Does PHP really need that ‘much’ memory for every call, or does that only happen for the first call (initializing something I guess) and then every consecutive call needs less Memory?

I’m asking, because I’m kind of surprised that an empty file already uses up 140KB – guessing that a couple of classes, functions and arrays will push that number up quite fast.

And yeah, I know that this probably counts as premature optimization, but I’m really curious about knowing where those 120KB are coming from, and if there’s a way to minify that cost per call.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:35:31+00:00Added an answer on June 13, 2026 at 9:35 pm

    The first comment on the php.net docs page states:

    If you note the peak memory usage of your script is 7MB don’t immediately worry or exacerbate the worry by doing a superficial calculation to tally how much memory the given page will consume for 1000 visitors, for example. Remember this very important fact: such peak script memory consumption is on the level of microseconds. The only way that particular script will require a dedicated 7000MB of memory, given our example, is if all 1000 visitors visited the page at the very same microsecond.

    http://php.net/manual/en/function.memory-get-peak-usage.php

    And the default allotment per connection is between 8-16mb, so you’re still way below that.

    For what it’s worth, doing the same thing on my server yields 650kb, so you’re already doing better than me 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just noticed the memory usage of a simple win32 C based GUI application
I just noticed that my website got hacked and all the .php files have
I just noticed that CPPUnit2 exists. Is anyone here using it? Or is CPPUnit
I just noticed a PHP config parameter called allow_url_include , which allows you to
I just noticed a strange behavior with deleting and re-writing a file : the
I just noticed someone using the PrimitiveType class. It seems like an alternative to
I just noticed that the email sent from my host using mail() function also
I just noticed that using the .NET HttpWebRequest , I wasn't getting gzip'd contents
I just noticed, using the css code below ignores the .input.cmp bit : .create
I just noticed that you can make an XSS attack by using dashes between

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.