|
Posted by Ivαn Sαnchez Ortega on 04/27/07 00:48
amygdala wrote:
> Finally my gutfeeling tells me, that when a script stops, the memory that
> was taken up by the script would clear instantly, but that doesn't always
> seem the case considering what some people here have mentioned about it.
> What's the real deal?
Keep in mind things like persistent database connections - they'll use a
little bit of resources, but they're worth on the ling run. Session
variables also take some resources.
Also, the PHP interpreter is smart enough to cache the *code* of the
script - obviously, the heap and stack of every run is destroyed after the
run is complete. Expect the PHP engine to keep half-parsed code somewhere
in memory.
But, as I always say, PHP is a high-level language - the Zend guys worry
about memory allocation so you don't have to. You *do* have to worry about
the algorithms your app use: they make the real difference.
If you were programming in C, I'd tell you lots of memory management tips.
But now, I'll tell you to go to your library to read the Design Patterns
book (by the Gang of Four). Make a beautiful design, implement nice
algorithms, don't worry about the low-level stuff.
Cheers,
--
----------------------------------
IvΓ‘n SΓ‘nchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
http://acm.asoc.fi.upm.es/~mr/
Proudly running Debian Linux with 2.6.20-1-amd64 kernel, KDE3.5.3, and PHP
5.2.0-11 generating this signature.
Uptime: 02:39:11 up 3 days, 12:58, 2 users, load average: 0.23, 0.23, 0.22
Navigation:
[Reply to this message]
|