/    Sign up×
Community /Pin to ProfileBookmark

apache – memory limit – It limits or forcefully allocates?

Hi,
i have a tech question.
i want to set the memory_limit to 20mb in either .htaccess or local php.ini or in my script.
will the server reserves 20mb every time any of my page loads or
is it just a size limiter setting so that only if any script tries to access more than 20mb will be stopped
???

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogFeb 09.2010 — My understanding, based on the brief description in the manual, is that it is only a limit, with actual allocation being script-dependent:

This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server.
[/quote]

However, if in doubt, you could do a quick test by setting it to some high value and then check the actual allocation in a script via memory_get_peak_usage().
×

Success!

Help @jayapalchandran spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...