当前位置:网站首页>Force freeing memory in PHP
Force freeing memory in PHP
2022-07-03 02:51:00 【fyin1314】
problem :
In a PHP program, I sequentially read a bunch of files (with file_get_contents
), gzdecode
them, json_decode
the result, analyze the contents, throw most of it away, and store about 1% in an array. stay PHP In the program , I read a pile of files in turn ( Use file_get_contents
), gzdecode
They do json_decode
Proceed with the result json_decode
, Analysis content , Throw away most of the content , Then, about 1% The contents of are stored in an array .
Unfortunately, with each iteration (I traverse over an array containing the filenames), there seems to be some memory lost (according to memory_get_peak_usage
, about 2-10 MB each time). Unfortunately , Every iteration ( I iterate through the array containing file names ), It seems that some memory will be lost ( according to memory_get_peak_usage
, About every time 2-10 MB).I have double- and triple-checked my code; I checked my code twice and three times ;I am not storing unneeded data in the loop (and the needed data hardly exceeds about 10MB overall), but I am frequently rewriting (actually, strings in an array). I don't store unnecessary data in the loop ( And the data required is almost no more than 10MB), But I often rewrite ( It's actually a string in an array ).Apparently, PHP does not free the memory correctly, thus using more and more RAM until it hits the limit. obviously ,PHP Memory is not released correctly , Therefore, more and more RAM, Until the limit is reached .
Is there any way to do a forced garbage collection? Is there any way to force garbage collection ?Or, at least, to find out where the memory is used? perhaps , At least , Find out where the memory is used ?
Solution :
Reference resources : https://stackoom.com/en/question/AKPq边栏推荐
- Gbase 8C system table PG_ auth_ members
- Chart. JS multitooltip tag - chart js multiTooltip labels
- Gbase 8C trigger (III)
- MATLAB小技巧(24)RBF,GRNN,PNN-神经网络
- Cron表达式介绍
- [C language] MD5 encryption for account password
- Gbase 8C function / stored procedure parameters (II)
- SQL Server Query spécifie la structure de la table
- The difference between left value and right value in C language
- Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition
猜你喜欢
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
Error when installing MySQL in Linux: starting mysql The server quit without updating PID file ([FAILED]al/mysql/data/l.pid
Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
Practice of traffic recording and playback in vivo
random shuffle注意
函数栈帧的创建与销毁
The process of connecting MySQL with docker
[shutter] bottom navigation bar page frame (bottomnavigationbar bottom navigation bar | pageview sliding page | bottom navigation and sliding page associated operation)
用docker 連接mysql的過程
Le processus de connexion mysql avec docker
随机推荐
random shuffle注意
I2C 子系统(三):I2C Driver
用docker 连接mysql的过程
怎么将yolov5中的PANet层改为BiFPN
2022-2028 global splicing display industry research and trend analysis report
JMeter performance test JDBC request (query database to obtain database data) use "suggestions collection"
Can netstat still play like this?
TCP 三次握手和四次挥手机制,TCP为什么要三次握手和四次挥手,TCP 连接建立失败处理机制
Basic operation of binary tree (C language version)
超好用的日志库 logzero
js根据树结构查找某个节点的下面的所有父节点或者子节点
Thunderbolt Chrome extension caused the data returned by the server JS parsing page data exception
As a leader, how to control the code version and demand development when the epidemic comes| Community essay solicitation
Tensorflow to pytorch notes; tf. gather_ Nd (x, y) to pytorch
[Hcia]No.15 Vlan间通信
sql server 查询指定表的表结构
How to return ordered keys after counter counts the quantity
MUX VLAN Foundation
"Analysis of 43 cases of MATLAB neural network": Chapter 43 efficient programming skills of neural network -- Discussion Based on the characteristics of the new version of MATLAB r2012b
Gbase 8C function / stored procedure parameters (I)