php as appserver vs memory-leaks

There was a comment by Olivier to one of my previous posts mentioning,that php was still leaking memory even on the simpliest example. That’s not exactly true. I added some more memory-information output to that example and made “hard”testing by ab. Here are some results:

Hello world! #22960Memory usage:232312Peak Memory usage:275352Memory usage last growed at request#71

Looks good enogh for me :)

p.s. weekend is coming — I will be posting some more-interesting stuff

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • DZone
  • FriendFeed
  • Reddit
  • Tumblr
  • Twitter
Liked this post? Follow me on twitter:@jimi_dini.

  • http://www.rooftopsolutions.nl/ Evert

    I think this is a great idea.. I’ve been thinking about this stuff for a while ..

    It will force programmers to clean up their data though.. (which is IMHO not a bad thing anyway)

    Once you have this setup.. do you think its viable to change some of the core stuff to C to make it run faster?

    I’ve also been hoping for a while for a more stricter PHP mode.. Which would force pear-style classpaths.. I think if something like that is implemented opcode caches can operate a lot more efficient as well..

    But I guess thats off-topic

  • http://indeyets.pp.ru/ indeyets

    Evert,the plan is:
    1) SCGI-protocol in PHP
    2) FastCGI-protocol in PHP
    3) FastCGI-protocol in C

  • http://www.lexode.com Olivier

    I tested your example (Revision 8),and it appears memory usage has “stages”:
    #1:185.852
    #2 to #98:growing over and over
    #99:246.148
    Then:stable
    Another growing at #250 approximately.

    I did this test 5 times,and I always have this “double growing”.

    And an additional test:just leave your app up &running,wait for a few minutes,and hit F5:memory usage will be higher.

  • http://indeyets.pp.ru/ indeyets

    Olivier:
    I actually think that this jumpy-slow “growing”has something to do with:
    a) growth of page-output (slow)
    b) the way php reuses memory (jumpy)

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna,tincidunt vitae molestie nec,molestie at mi. Nulla nulla lorem,suscipit in posuere in,interdum non magna.