查看Workerman日志发现出现内存溢出错误,应该怎么去区分是内存泄漏或是接口数据量过大。
目前内存也一直出现持续增加情况,但不是规律增加.目前总内存达到了1437.95M,比两天前增加了400m。

2026-10-31 13:31:50 pid:14824 Worker[14824] process terminated with ERROR: E_ERROR "Allowed memory size of 268435456 bytes exhausted (tried to allocate 10489856 bytes) in /data/wwwroot/webman-health/vendor/workerman/webman-framework/src/support/helpers.php on line 185"
2026-10-31 13:31:50 pid:10516 worker[webman:14824] exit with status 65280
2026-10-31 13:49:15 pid:14852 Worker[14852] process terminated with ERROR: E_ERROR "Allowed memory size of 268435456 bytes exhausted (tried to allocate 10489856 bytes) in /data/wwwroot/webman-health/vendor/workerman/webman-framework/src/support/helpers.php on line 185"
2026-10-31 13:49:15 pid:10516 worker[webman:14852] exit with status 65280
2026-10-31 13:55:57 pid:14867 Worker[14867] process terminated with ERROR: E_ERROR "Allowed memory size of 268435456 bytes exhausted (tried to allocate 10489856 bytes) in /data/wwwroot/webman-health/vendor/workerman/webman-framework/src/support/helpers.php on line 185"
2026-10-31 13:55:57 pid:10516 worker[webman:14867] exit with status 65280
{
"name": "workerman/webman",
"type": "project",
"keywords": [
"high performance",
"http service"
],
"homepage": "https://www.workerman.net",
"license": "MIT",
"description": "High performance HTTP Service Framework.",
"authors": [
{
"name": "walkor",
"email": "walkor@workerman.net",
"homepage": "https://www.workerman.net",
"role": "Developer"
}
],
"support": {
"email": "walkor@workerman.net",
"issues": "https://github.com/walkor/webman/issues",
"forum": "https://wenda.workerman.net/",
"wiki": "https://workerman.net/doc/webman",
"source": "https://github.com/walkor/webman"
},
"require": {
"php": ">=8.1",
"workerman/webman-framework": "~2.2",
"monolog/monolog": "^2.0",
"webman/database": "^2.1",
"illuminate/pagination": "^12.38",
"illuminate/events": "^12.38",
"symfony/var-dumper": "^7.3",
"webman/redis-queue": "^1.3",
"webman/rate-limiter": "^1.1",
"intervention/image": "^3.11",
"webman/event": "^1.0",
"yansongda/pay": "3.7.20.0",
"php-di/php-di": "^7.0",
"webman/redis": "^2.1",
"webman/log": "~2.1",
"vlucas/phpdotenv": "^5.6",
"workerman/crontab": "^1.0",
"webman/gateway-worker": "^2.1",
"workerman/validation": "^3.1",
"endroid/qr-code": "^6.0",
"webman/console": "^2.1",
"firebase/php-jwt": "^7.0",
"hhink/webman-sms": "^1.0",
"workerman/workerman": "~5.1",
"webman/validation": "^2.2",
"webman/limiter": "^2.2",
"qiniu/php-sdk": "^7.14",
"godruoyi/php-snowflake": "^3.2",
"robmorgan/phinx": "^0.16.11"
},
"suggest": {
"ext-event": "For better performance. "
},
"autoload": {
"psr-4": {
"": "./",
"app\": "./app",
"App\": "./app",
"app\View\Components\": "./app/view/components"
}
},
"scripts": {
"post-package-install": [
"support\Plugin::install"
],
"post-package-update": [
"support\Plugin::install"
],
"pre-package-uninstall": [
"support\Plugin::uninstall"
]
},
"minimum-stability": "stable",
"prefer-stable": true
}
https://www.workerman.net/search?keyword=%E5%86%85%E5%AD%98%E6%B3%84%E6%BC%8F
进程截图里各个进程内存正常,应该是业务从数据库读取太多数据导致的。
你看你下报错的那几行代码是什么就定位到了。那行代码申请了10489856 bytes大概10M内存,一般业务不会申请这么大。
就是框架返回json数据格式的 response
现在就觉得很矛盾 不可能有接口数据能达到256m这种规模的,排查了一圈也没发现有疑似内存泄漏的