Memory leak, what does it mean?

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

    #1

    Memory leak, what does it mean?

    What does this me?

    /usr/ports/lang/php5-cli/work/php-5.0.5/main/streams/streams.c(1209) : Freeing
    0x083AC564 (1 bytes), script=/home/webmaster/allphp/main.php
    /usr/ports/lang/php5-cli/work/php-5.0.5/ext/standard/file.c(472) : Actual locati
    on (location was relayed)
    Last leak repeated 5 times
    === Total 6 memory leaks detected ===

    Is it my script or is it php? The script output appears
    correct. Should I do something?

    --
    Lars Eighner usenet@larseigh ner.com http://www.larseighner.com/
    It's important for us to explain to our nation that life is important. It's
    not only life of babies, but it's life of children living in, you know, the
    dark dungeons of the Internet.--G.W. Bush, Arlington Heights, Ill.,10/24/00
  • Erwin Moller

    #2
    Re: Memory leak, what does it mean?

    Lars Eighner wrote:
    [color=blue]
    > What does this me?
    >
    > /usr/ports/lang/php5-cli/work/php-5.0.5/main/streams/streams.c(1209) :
    > Freeing 0x083AC564 (1 bytes), script=/home/webmaster/allphp/main.php
    > /usr/ports/lang/php5-cli/work/php-5.0.5/ext/standard/file.c(472) : Actual
    > locati on (location was relayed)
    > Last leak repeated 5 times
    > === Total 6 memory leaks detected ===
    >
    > Is it my script or is it php? The script output appears
    > correct. Should I do something?
    >[/color]

    Hi,

    A memoryleak means something like this:
    (Mostly coded in C, and in very simple terms)
    1) A process wants some bytes to store information (for example a variable)
    and asks the kernel to allocate them on behalf of that process.

    2) Process does its thing, probably using that just allocated memoryspace.

    3) Because of some unexpected behaviour or a plain bug the process ends
    without telling the kernel to free the memory it allocated for the process.
    (under normal circumstances the process WILL tell the kernel to free the
    memory.)

    4) Memory will be allocated to a process that is gone. So no other process
    can use that memory, hence the name memoryleak.

    What you should do about it?
    I would report it at http://bugs.php.net/
    It is probably way too complex for yourself to fix.

    Be sure you give them a detailed report, possibly with an example where it
    happens.
    You are helping the development of PHP a lot by filing bugs!

    Regards,
    Erwin Moller

    Comment

    • Jasen Betts

      #3
      Re: Memory leak, what does it mean?

      On 2006-02-10, Erwin Moller <since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c om> wrote:
      [color=blue]
      > A memoryleak means something like this:
      > (Mostly coded in C, and in very simple terms)
      > 1) A process wants some bytes to store information (for example a variable)
      > and asks the kernel to allocate them on behalf of that process.[/color]

      Actually it asks a function in the runtime library, eg. /usr/lib/libc.*.so or
      c:/windows/system/msvcrt*.dll
      [color=blue]
      > 2) Process does its thing, probably using that just allocated memoryspace.
      >
      > 3) Because of some unexpected behaviour or a plain bug the process ends
      > without telling the kernel to free the memory it allocated for the process.
      > (under normal circumstances the process WILL tell the kernel to free the
      > memory.)
      >
      > 4) Memory will be allocated to a process that is gone. So no other process
      > can use that memory, hence the name memoryleak.[/color]

      Actually the OS kernal will free the memory on most systems, but as you say
      the leak indicates a malfunction that may have worse conseqqquences.
      [color=blue]
      > Be sure you give them a detailed report, possibly with an example where it
      > happens.
      > You are helping the development of PHP a lot by filing bugs![/color]

      Definately.

      Bye.
      Jasen

      Comment

      Working...