{"id":15021647,"url":"https://github.com/php/pecl-php-memtrack","last_synced_at":"2026-01-11T05:33:55.041Z","repository":{"id":141192575,"uuid":"10133563","full_name":"php/pecl-php-memtrack","owner":"php","description":"PHP extension to watch (unusually high) memory consumption in PHP scripts","archived":true,"fork":false,"pushed_at":"2013-05-17T23:26:48.000Z","size":120,"stargazers_count":4,"open_issues_count":0,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-10-29T23:48:57.466Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://pecl.php.net/package/memtrack","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-17T22:51:54.000Z","updated_at":"2023-08-24T17:01:41.000Z","dependencies_parsed_at":"2023-03-12T03:16:42.264Z","dependency_job_id":null,"html_url":"https://github.com/php/pecl-php-memtrack","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-php-memtrack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-php-memtrack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-php-memtrack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php%2Fpecl-php-memtrack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php","download_url":"https://codeload.github.com/php/pecl-php-memtrack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235198444,"owners_count":18951501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T19:56:50.183Z","updated_at":"2025-10-03T22:30:46.134Z","avatar_url":"https://github.com/php.png","language":"C","readme":"memtrack PHP extension\n======================\n\n1. How it works\n---------------\n\nmemtrack is a PHP extension that tracks memory consumption in PHP scripts \nand produces reports (warnings) when the consumption reaches certain levels \nset by the user.\n\nmemtrack replaces default executor function by its own function which \ncompares memory usage before and after running the original executor, \nthis way we can tell how much the memory usage has changed.\n\n2. Configuration\n----------------\n\nThe following INI options are available at the moment:\n\n memtrack.enabled - Boolean flag, which enables or disabled the extension.\n                    Default value is 0, i.e. disabled.\n\n memtrack.soft_limit - A soft memory limit. The extension produces a warning when a \n                       function reaches it, if the function is not ignored.\n\t\t\t\t\t   Default value is 0.\n\n memtrack.hard_limit - A hard memory limit. The extension produces a warning when a\n                       function reaches it, whether or not the function is listed \n\t\t\t\t\t   in memtrack.ignore_functions.\n\t\t\t\t\t   Default value is 0.\n\n memtrack.ignore_functions - A comma- or whitespace-separated list of functions, \n                             which are to be ignored. The values are case-insensitive, \n\t\t\t\t\t\t\t for class methods use Class::method syntax.\n\n memtrack.vm_limit - Virtual memory size limit (set on a process), which is measured on shutdown only.\n\t\t\t\t\t The extension produces a warning when the limit is reached.\n\t\t\t\t\t NB: Available only on Linux.\n\t\t\t\t\t Default value is 0.\n\n3. Examples\n-----------\n\n# php -d memtrack.enabled=1 -d memtrack.soft_limit=10000 -d memtrack.ignore_functions=\"\" -r '$a = str_repeat(\"aaaaaaaa\", 100000);'\n\nWarning: [memtrack] [pid 26154] internal function str_repeat() executed in Command line code on line 1 allocated 1048576 bytes in Command line code on line 1\n\n# /tmp/1.php\n\u003c?php\nfunction foo() {\n    $a = array();\n    for ($i = 0; $i \u003c 10000; $i++) $a[] = \"test\";\n    return $a;\n}\n$arr = foo();\n?\u003e\n\n# php -d memtrack.enabled=1 -d memtrack.soft_limit=1M -d memtrack.ignore_functions=\"\" -d memtrack.vm_limit=3M /tmp/1.php\n\nWarning: [memtrack] [pid 26177] user function foo() executed in /tmp/1.php on line 7 allocated 4194304 bytes in /tmp/1.php on line 0\nWarning: [memtrack] [pid 26177] virtual memory usage on shutdown: 32911360 bytes in Unknown on line 0\n\n\n4. Compatibility with other extensions\n--------------------------------------\n\nmemtrack is not a Zend extension, hence it doesn't have any extensions compatibility problems.\nThough it was noticed that running Zend Optimizer with memtrack produces op_array's without any \ninformation left, so memtrack is unable to fetch function and class names, as well as filenames \nand line numbers, which makes memtrack pretty much useless.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp%2Fpecl-php-memtrack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp%2Fpecl-php-memtrack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp%2Fpecl-php-memtrack/lists"}