Professional Web Applications Themes

#25335 [Opn]: Memory Leak with error handler and exceptions - PHP Development

ID: 25335 Updated by: [email]hellyphp.net[/email] Reported By: cunha17 at uol dot com dot br Status: Open Bug Type: Zend Engine 2 problem Operating System: * PHP Version: 5CVS-2003-08-31 (dev) Assigned To: helly New Comment: For me it seems as if a zval is created after memory manager shutdown. If this is the case we would need to return 'internal zvals' when creating new ones after normal script runtime and also their data must be malloced which is impossible. Or we need to prevent user functions from beeing called after shutdown_executor() gets called. Previous Comments: ------------------------------------------------------------------------ [2003-09-10 21:49:16] cunha17 at uol ...

  1. #1

    Default #25335 [Opn]: Memory Leak with error handler and exceptions

    ID: 25335
    Updated by: [email]hellyphp.net[/email]
    Reported By: cunha17 at uol dot com dot br
    Status: Open
    Bug Type: Zend Engine 2 problem
    Operating System: *
    PHP Version: 5CVS-2003-08-31 (dev)
    Assigned To: helly
    New Comment:

    For me it seems as if a zval is created after memory manager shutdown.
    If this is the case we would need to return 'internal zvals' when
    creating new ones after normal script runtime and also their data must
    be malloced which is impossible. Or we need to prevent user functions
    from beeing called after shutdown_executor() gets called.


    Previous Comments:
    ------------------------------------------------------------------------

    [2003-09-10 21:49:16] cunha17 at uol dot com dot br

    Is anyone looking at this ?

    ------------------------------------------------------------------------

    [2003-08-31 19:44:50] cunha17 at uol dot com dot br

    Description:
    ------------
    This code below gives some memory leak. The leak only appears when
    throwing exceptions inside error handler.
    The code I'm using is a little more complex 'cause it translates PHP
    errors into PHP Exceptions, but this piece of code reproduces the leak
    correctly.


    Reproduce code:
    ---------------
    <?
    function my_error($nr, $text, $file, $line, $vars)
    {
    throw new Exception($text);
    }

    error_reporting(E_ALL);
    set_error_handler("my_error");

    try {
    include("unexistent");
    } catch (Exception $e) {
    echo "EXCEPTION!!!";
    }
    ?>

    Expected result:
    ----------------
    EXCEPTION!!!

    Actual result:
    --------------
    EXCEPTION!!!/usr/src/zend2/php-src/Zend/zend.c(914) : Freeing
    0x404C9340 (16 bytes), script=leak.php
    === Total 1 memory leaks detected ===



    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=25335&edit=1[/url]
    helly@php.net Guest

  2. #2

    Default #25335 [Opn]: Memory Leak with error handler and exceptions

    ID: 25335
    User updated by: cunha17 at uol dot com dot br
    Reported By: cunha17 at uol dot com dot br
    Status: Open
    Bug Type: Zend Engine 2 problem
    Operating System: *
    PHP Version: 5CVS-2003-08-31 (dev)
    Assigned To: helly
    New Comment:

    My knowledge of ZE2 is too limited but I don't think the memory manager
    got shutdown when the error handler is called (does it?). IMHO it seems
    the error handler calling mechanism is allocating something and not
    releasing it since the user function(error handler) is terminated
    abnormally (exception) and not in the expected way (function end
    reached, return or exit/die).


    Previous Comments:
    ------------------------------------------------------------------------

    [2003-09-14 15:20:55] [email]hellyphp.net[/email]

    For me it seems as if a zval is created after memory manager shutdown.
    If this is the case we would need to return 'internal zvals' when
    creating new ones after normal script runtime and also their data must
    be malloced which is impossible. Or we need to prevent user functions
    from beeing called after shutdown_executor() gets called.

    ------------------------------------------------------------------------

    [2003-09-10 21:49:16] cunha17 at uol dot com dot br

    Is anyone looking at this ?

    ------------------------------------------------------------------------

    [2003-08-31 19:44:50] cunha17 at uol dot com dot br

    Description:
    ------------
    This code below gives some memory leak. The leak only appears when
    throwing exceptions inside error handler.
    The code I'm using is a little more complex 'cause it translates PHP
    errors into PHP Exceptions, but this piece of code reproduces the leak
    correctly.


    Reproduce code:
    ---------------
    <?
    function my_error($nr, $text, $file, $line, $vars)
    {
    throw new Exception($text);
    }

    error_reporting(E_ALL);
    set_error_handler("my_error");

    try {
    include("unexistent");
    } catch (Exception $e) {
    echo "EXCEPTION!!!";
    }
    ?>

    Expected result:
    ----------------
    EXCEPTION!!!

    Actual result:
    --------------
    EXCEPTION!!!/usr/src/zend2/php-src/Zend/zend.c(914) : Freeing
    0x404C9340 (16 bytes), script=leak.php
    === Total 1 memory leaks detected ===



    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=25335&edit=1[/url]
    cunha17 at uol dot com dot br Guest

Similar Threads

  1. SQL Memory Leak
    By tompeer1 in forum Coldfusion Server Administration
    Replies: 2
    Last Post: December 11th, 10:04 PM
  2. #39438 [NEW]: Memory leak PHP Fatal error: Out of memory
    By nikolas dot hagelstein at gmail dot com in forum PHP Bugs
    Replies: 11
    Last Post: December 1st, 08:08 PM
  3. memory problem/memory leak
    By Tron Juan Del Marco webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 1
    Last Post: January 20th, 06:02 PM
  4. Memory consumption of Ruby/mod_ruby combo on Apache [memory leak]
    By David Heinemeier Hansson in forum Ruby
    Replies: 4
    Last Post: September 10th, 01:58 AM
  5. #25335 [NEW]: Memory Leak with error handler and exceptions
    By cunha17 at uol dot com dot br in forum PHP Development
    Replies: 0
    Last Post: September 1st, 12:45 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139