SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Issues with PHP Development

    Hello Everyone,
    I recently started developing a PHP web application(about 2 months). I have loads of experience in Java,C# etc etc.
    Well I have used loads of classes , and everything seems to work. However I do have a question regarding memory Management of PHP. How does php's memory Management works. There are things like garbage collector in java.Does php comes with garbage collector or do we have to free memory manually.

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    This kind of thing generally isn't necessary in PHP Development - it's a different concept entirely.

    A PHP application runs for a split second. Different stages of the application are, in fact, different runs of the application but with different parameters.

    When the PHP script comes to an end (and usually this would be a fraction of a second) all resources, variables and loaded objects are released from memory.

    So, unless your application is very heavy loaded (and I mean VERY heavy - megabytes of data going around all over the place) then you should be fine.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arkinstall View Post
    This kind of thing generally isn't necessary in PHP Development - it's a different concept entirely.

    A PHP application runs for a split second. Different stages of the application are, in fact, different runs of the application but with different parameters.

    When the PHP script comes to an end (and usually this would be a fraction of a second) all resources, variables and loaded objects are released from memory.

    So, unless your application is very heavy loaded (and I mean VERY heavy - megabytes of data going around all over the place) then you should be fine.
    Thanks for the reply. I understand what you mean. I know it is job of the server to release the memmory after an application is executed. Am I correct? Well I am dealing with PDF generation on the fly.Hence this question. Regards.

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP does have a garbage collector, but it is probably not as advanced as the GC of Java, etc. However, you can mark a variable to be processed with the GC using unset()

    Edit:

    Didn't see the new reply, since I was on my 320x240 Pocket PC...

    But yes, PHP will release memory when the script ends.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •