You are here: Re: Garbage collection « PHP Programming Language « IT news, forums, messages
Re: Garbage collection

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]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация