hhxsv5 / laravel-s

LaravelS is an out-of-the-box adapter between Laravel/Lumen and Swoole.
MIT License
3.83k stars 472 forks source link

register_providers添加 \App\Providers\RouteServiceProvider::class存在内存泄漏问题,有好的处理方案吗 #477

Closed phperzhangdongliang closed 1 month ago

phperzhangdongliang commented 2 months ago
  1. Your software version (Screenshot of your startup)

    Component | Version | +---------------------------+---------+ | PHP | 8.1.4 | | Swoole | 5.1.2 | | LaravelS | 3.7.38 | | Laravel Framework [local] | 10.31.0

  2. Detail description about this issue(error/log)

    在register_providers中添加了\App\Providers\RouteServiceProvider::class,会出现内存泄漏问题,注释掉就没有内存泄漏了,这个怎么处理呢?一下是用检测方法检测的内存变化 {"prev_mem":25157592,"curr_mem":25159888,"diff_mem":2296} {"prev_mem":25159888,"curr_mem":25161544,"diff_mem":1656} {"prev_mem":25161544,"curr_mem":25163200,"diff_mem":1656} {"prev_mem":25163200,"curr_mem":25164856,"diff_mem":1656} {"prev_mem":25164856,"curr_mem":25232048,"diff_mem":67192} {"prev_mem":25232048,"curr_mem":25233704,"diff_mem":1656} {"prev_mem":25233704,"curr_mem":25235360,"diff_mem":1656} {"prev_mem":25235360,"curr_mem":25237016,"diff_mem":1656}

  3. Some reproducible code blocks and steps

    'register_providers' => [ \App\Providers\RouteServiceProvider::class //每次请求重新加载一次路由 ],

phperzhangdongliang commented 2 months ago

@hhxsv5

hhxsv5 commented 1 month ago

为啥会重新注册RouteServiceProvider?这个应该只注册一次的

phperzhangdongliang commented 1 month ago

为啥会重新注册RouteServiceProvider?这个应该只注册一次的

因为之前写的一些逻辑需要重新加载路由,现在改了写法,已经解决