Dear all,
This is my first time interaction with the php documentation process, so sorry in advance for rookie mistakes. On http://php.net/manual/en/errorfunc.configuration.php, the php.ini variable report_memleaks is documented as follows: "If this parameter is set to Off, then memory leaks will not be shown (on stdout or in the log). This has only effect in a debug compile, and if error_reporting includes E_WARNING in the allowed list " IMO this documentation is ambiguous about where the output is written to, to the point of being wrong on Windows. The ambiguous point is "on stdout or in the log"; this wording makes it seem as if the target of where the memory reports are send to, is the standard php error log, which can be configured with the various php logging settings. It also implies that on Windows something may be output to the 'regular' channels of stdout/stderr (more specifically, to the console when using the CLI SAPI). However, the implementation of this memory leak reporting, around lines 1160 in main.c of the php 5.2.17 release tarball, is like this: # if defined(PHP_WIN32) OutputDebugString(memory_leak_buf); # else fprintf(stderr, "%s", memory_leak_buf); # endif For posix, maybe there is some redirection underneath the surface that sends output to the log file depending on the user's settings; I don't know. In that case, my suggestion below needs to be updated to reflect that. It seems to me that the current reference to stdout is certainly wrong: either it goes to stderr, or to the php log file. Anyway, my main concern is that the Windows version outputs to the debugging console which needs to be viewed with a separate tool such as an IDE's output window or DbgView. Therefore, my suggestion is to change the documentation of this .ini setting to the following: "When set to On (the default), this parameter will show a report of memory leaks detected by the Zend memory manager. This report will be send to stderr on Posix platforms. On Windows, it will be send to the debugger using OutputDebugString(), and can be viewed with tools like DbgView. This parameter only has effect in a debug compile, and if error_reporting includes E_WARNING in the allowed list." The first part is to make clear that it only reports on leaks in memory allocated with emalloc/efree. The DbgView reference could potentially link to http://technet.microsoft.com/en-us/sysinternals/bb896647 (it's a free download) , but I'm not sure what the policy on linking is. Thanks for considering. regards, roel