Memory Leak ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • K

    #1

    Memory Leak ?

    Hi,

    I am using PHP 4.3.9 in Linux 2.4.20-37. When I run this program:

    echo "Memory Usage: " . memory_get_usag e() . "\n";
    for($i=1;$i<100 0;$i++){
    $dom = domxml_open_fil e("xml/ht_players.xml" );
    unset($dom);
    }
    echo "Memory Usage: " . memory_get_usag e() . "\n";

    I get the this results:

    Memory Usage: 15336
    Memory Usage: 795544

    Why memory usage grow so much if I use unset($dom)?. There is anyway
    to prevent/fix this ?

    Grettings.

    -k

    PS: excuse my bad english :S
  • botio

    #2
    Re: Memory Leak ?

    K wrote:
    [color=blue]
    > Hi,
    >
    > I am using PHP 4.3.9 in Linux 2.4.20-37. When I run this program:
    >
    > echo "Memory Usage: " . memory_get_usag e() . "\n";
    > for($i=1;$i<100 0;$i++){
    > $dom = domxml_open_fil e("xml/ht_players.xml" );
    > unset($dom);
    > }
    > echo "Memory Usage: " . memory_get_usag e() . "\n";
    >
    > I get the this results:
    >
    > Memory Usage: 15336
    > Memory Usage: 795544
    >
    > Why memory usage grow so much if I use unset($dom)?. There is anyway
    > to prevent/fix this ?
    >[/color]

    Hi,

    I had the same problem today and after some searching I found something
    interesting. (but didn't tested it yet)

    you should use $dom->free() instead of unset($dom)

    it's not documented but it exists since 4.3.3
    see:



    Comment

    Working...