Results 1 to 7 of 7

Thread: What is the Memtrack in PHP?

  1. #1
    Join Date
    Jun 2009
    Posts
    230

    What is the Memtrack in PHP?

    Hi friends,
    I have done some basic examples of PHP programming language, so i don't have enough knowledge about it. While going through my notes, I found some information about the memtrack, which was not explained properly. So I thought to ask you guys, because you also explain very well. Please tell me what is the Memtrack in PHP? Expecting some help sooner.!!

  2. #2
    Join Date
    Jul 2006
    Posts
    442

    Re: What is the Memtrack in PHP?

    The purpose of this extension is to detect the most memory hungry scripts and functions. Memtrack tracks memory consumption in PHP scripts and produces reports (warnings) when the consumption reaches certain levels set by the user. This is achieved by replacing default executor function by a special function which compares memory usage before and after running the original executor - this way we can tell how much the memory usage has changed during the execution of the current part of the code.
    "When they give you ruled paper, write the other way..." J.R.J.

  3. #3
    Join Date
    Aug 2006
    Posts
    227

    Re: What is the Memtrack in PHP?

    Zend Engine runs its executor for each opcode array (op_array), which usually means function, plain script and such, so memtrack doesn't have any noticeable effect on performance. Memtrack doesn't provide any functions, there are only INI directives which allow you to configure the way it should work. The behavior of this extension including the names of its functions and any other documentation surrounding this extension may change without notice in a future release of PHP.
    I do to dead flowers what people at morgues do to dead people. Suck all the moisture out, dip them in plastic, paint them up pretty and put them in a nice frame.

  4. #4
    Join Date
    Mar 2008
    Posts
    349

    Re: What is the Memtrack in PHP?

    No external libraries are needed to build this extension. The behaviour of these functions is affected by settings in php.ini. The following is a short explanation of the configuration directives :
    • memtrack.enabled boolean - Disables or enables the extension. Default value is 0, i.e. disabled.
    • memtrack.soft_limit int - Soft memory limit. The extension checks memory consumption before and after executing an op_array and produces a warning is the difference between the two values is equal to or greater than the soft limit, but only if the function is not ignored. Setting this option to 0 also disables both soft and hard limit warnings. Default value is 0, i.e. no warnings is produced.

  5. #5
    Join Date
    Mar 2008
    Posts
    672

    Re: What is the Memtrack in PHP?

    The following are some more configuration directives that are related to the Memtrack :
    • memtrack.hard_limit int - Limit physical memory. The extension checks consumption before and after the execution of an opcode table, and then produces an alert if the difference between the two values equals or exceeds the software limit, even if the function is ignored. Giving This directive value of 0, disables the physical limits. By default, this directive is 0, so no alert is generated.
    • memtrack.vm_limit int - Virtual memory limit (per process). This limit is checked at the termination of the script, and a warning is issued if the memory consumption is larger than this limit. This option is only supported on OS where mallinfo function () is available (ie Linux).
    • memtrack.ignore_functions string - A list of functions that will be ignored by the software limit. The functions are separated by commas or spaces. The values are case insensitive, and methods, use the syntax class:: method.

  6. #6
    Join Date
    May 2008
    Posts
    2,389

    Re: What is the Memtrack in PHP?

    I am providing you the basic example on using memtrack extension. The following is the coding for creating large array in a function :
    PHP Code:
    <?php
     
    function call() {
        
    $a = array();
        for (
    $i 0$i 10000$i++) $a[] = "test";
        return 
    $a;
    }
    $arr call();
     
    ?>

  7. #7
    Mable2 Guest

    Re: What is the Memtrack in PHP?

    memtrack is a PHP extension that tracks memory consumption in PHP scripts
    and produces reports (warnings) when memory usage reaches certain levels
    set by the user.

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
  •  
Page generated in 1,714,210,082.58363 seconds with 16 queries