This article mainly introduces the use of PHP memory how to obtain, interested in small partners can refer to
PHP built-in function memory_get_usage ()-Returns the amount of memory allocated to PHP, in bytes (byte). These functions are very useful
PHP's memory management mechanism is quite exhaustive, and it is more similar to Java's garbage collection mechanism at this point. For C or C + + most of the time, the programmer can only release the application space. In PHP, because of the
PHP memory depletion error analysis someone recently told me that an error often occurs during the use of a wordpress plug-in on the host. after enabling the dispaly_error function of php, I found that it reported "Fatal error: allowed memory size
Php's memory management mechanism is quite detailed. it is more like & amp; 20284; and java's garbage collection mechanism. For c language or c & amp; 43; & amp; 43; most of the time, programmers can only release the applied space. In php, because
PHP Memory View
PHP function: memory_get_usage () View Memory usage information
Observing the memory usage of your program allows you to better optimize your code. PHP has a garbage collection mechanism, and a complex set of memory management
One, function prototypes
int Memory_get_usage ([bool $real _usage = false])
Two, version compatible
PHP 4 >= 4.3.2, PHP 5
Third, basic usage and examples
1, gets the current memory consumption
Copy the Code code as follows:
Echo
Who Moved my memory: PHP memory leaks, system cache consumption?
?
Preface: Continue my usual title party style, say the example solution, no in-depth discussion.
?
Scenario: The image quality (100) of the compression of the line slice service,
Because the variable occupies a different space, so it consumes a different amount of memory, in PHP we can use "memory_get_usage" to get the current consumption of PHP memory. But depending on the operating system, PHP version, and how PHP works,
Fatal error:allowed memory size of 134217728 bytes exhausted (tried to allocate 1099 bytes)Fatal error:allowed memory size of 134217728 bytes exhausted (tried to allocate 1099 bytes)
Explanation is that the available memory is depleted, which is
The memory manager for PHP is layered (hierarchical). This manager has a total of three layers: storage layer (storage), heap (heap) layer and Emalloc/efree layer. The storage layer uses functions such as malloc (), mmap () to actually request
When you export Excel by using XML, you can export Excel normally when you find a small number (below 1k), but when you increase the number of exports (several K), you find that the exported Excel data is incomplete.
(In my local is good, online
Transferred from: http://lhdst-163-com.iteye.com/blog/2149653PHP export Excel Relatively many children's shoes have met, the use of Phpexcel class is also really convenient, but the export of big data when it is not so simple, often accompanied by
If the file data generated in the system is too long and then automatically truncated, what is the cause? This small editor has encountered problems caused by the loss of post data, let's take a look. If the file data generated in the system is too
PHP export Excel Relatively many children's shoes have met, the use of Phpexcel class is also really convenient, but the export of big data when it is not so simple, often accompanied by some timeouts or memory overflow problems, the following will
Http://blog.sina.com.cn/s/blog_4ec7952d0101fcrd.htmlPHPExcel resolving excessive memory consumption-set the Cell object cachePhpexcel is a powerful PHP open source class that handles Excel, but a big problem is that it takes up too much memory,
Php: // How does memory use my intention to load controller files more efficiently? after all, the read memory is much faster than the read disk. I checked that include may support protocols such as php: // memory, but I didn't know how to use it in
Recently, the company encountered a php memory overflow problem when exporting order information. The reason is that the temporary file generated during download is too large to accommodate the PHP memory, when I thought of changing the PHP memory
Analysis of memory usage when PHP queries a large amount of MySQL data. Yesterday, a colleague mentioned in the PHP discussion group that a project he created had too many results (up to 0.1 million results) returned by MySQL queries, resulting in
This solution provides a detailed description of the methods for downloading PHP ultra-large files and resumable download. A php memory overflow problem occurred recently during export because the temporary file generated during download is too
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.