-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Added: [zend_]memory_reset_peak_usage() #8151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--TEST-- | ||
void memory_reset_peak_usage(); | ||
--SKIPIF-- | ||
<?php | ||
if (getenv("USE_ZEND_ALLOC") === "0") { | ||
die("skip Zend MM disabled"); | ||
} | ||
?> | ||
--INI-- | ||
memory_limit=-1 | ||
--FILE-- | ||
<?php | ||
$array0 = range(1, 1024 * 1024); | ||
$m0 = memory_get_peak_usage(); | ||
$array1 = range(1, 1024 * 1024); | ||
var_dump(($m1 = memory_get_peak_usage()) > $m0); | ||
unset($array0, $array1); | ||
memory_reset_peak_usage(); | ||
var_dump(memory_get_peak_usage() < $m1); | ||
?> | ||
--EXPECT-- | ||
bool(true) | ||
bool(true) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2175,6 +2175,9 @@ ZEND_END_ARG_INFO() | |
|
||
#define arginfo_memory_get_peak_usage arginfo_memory_get_usage | ||
|
||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_memory_reset_peak_usage, 0, 0, IS_VOID, 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change looks suspicious to me: the stub file from which this file is generated is not modified. I suspect that this was changed manually instead of being generated, which would then be lost on next run of the generator. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And you were so right! I'm going to fix this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would make sense. Would also prevent adding malicious code to generated files like zend_vm_execute.h. |
||
ZEND_END_ARG_INFO() | ||
|
||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_version_compare, 0, 2, MAY_BE_LONG|MAY_BE_BOOL) | ||
ZEND_ARG_TYPE_INFO(0, version1, IS_STRING, 0) | ||
ZEND_ARG_TYPE_INFO(0, version2, IS_STRING, 0) | ||
|
@@ -2824,6 +2827,7 @@ ZEND_FUNCTION(serialize); | |
ZEND_FUNCTION(unserialize); | ||
ZEND_FUNCTION(memory_get_usage); | ||
ZEND_FUNCTION(memory_get_peak_usage); | ||
ZEND_FUNCTION(memory_reset_peak_usage); | ||
ZEND_FUNCTION(version_compare); | ||
#if defined(PHP_WIN32) | ||
ZEND_FUNCTION(sapi_windows_cp_set); | ||
|
@@ -3479,6 +3483,7 @@ static const zend_function_entry ext_functions[] = { | |
ZEND_FE(unserialize, arginfo_unserialize) | ||
ZEND_FE(memory_get_usage, arginfo_memory_get_usage) | ||
ZEND_FE(memory_get_peak_usage, arginfo_memory_get_peak_usage) | ||
ZEND_FE(memory_reset_peak_usage, arginfo_memory_reset_peak_usage) | ||
ZEND_SUPPORTS_COMPILE_TIME_EVAL_FE(version_compare, arginfo_version_compare) | ||
#if defined(PHP_WIN32) | ||
ZEND_FE(sapi_windows_cp_set, arginfo_sapi_windows_cp_set) | ||
|
Uh oh!
There was an error while loading. Please reload this page.