Title: Memory leak · Issue #217 · reactphp/reactphp · GitHub
Open Graph Title: Memory leak · Issue #217 · reactphp/reactphp
X Title: Memory leak · Issue #217 · reactphp/reactphp
Description: Hi, I was playing with the examples and I noticed something weird with https://github.com/reactphp/react/blob/master/examples/test-memory-http.php. I was trying to test how React handles many concurrent connections ( 1k ).
Open Graph Description: Hi, I was playing with the examples and I noticed something weird with https://github.com/reactphp/react/blob/master/examples/test-memory-http.php. I was trying to test how React handles many concu...
X Description: Hi, I was playing with the examples and I noticed something weird with https://github.com/reactphp/react/blob/master/examples/test-memory-http.php. I was trying to test how React handles many concu...
Opengraph URL: https://github.com/reactphp/reactphp/issues/217
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Memory leak","articleBody":"Hi,\nI was playing with the examples and I noticed something weird with `https://github.com/reactphp/react/blob/master/examples/test-memory-http.php`. \nI was trying to test how React handles many concurrent connections ( 1k ).\n\n```\n\u003c?php\nrequire_once \"vendor/autoload.php\";\n\ngc_enable();\nvar_dump(gc_enabled());\n$loop = new React\\EventLoop\\StreamSelectLoop();\n$socket = new React\\Socket\\Server($loop);\n$http = new React\\Http\\Server($socket, $loop);\n$i = 0;\n$http->on(\n 'request',\n function (\\React\\Http\\Request $request, \\React\\Http\\Response $response) use (&$i) {\n $i++;\n $response->writeHead();\n $file = fopen('composer.phar', \"r\");\n\n $response->write(fread($file, filesize('composer.phar')));\n fclose($file);\n $response->end(\"Hello World!\\n\");\n }\n);\n$loop->addPeriodicTimer(\n 2,\n function () use (&$i) {\n var_dump(gc_collect_cycles());\n $kmem = memory_get_usage(true) / 1024;\n $mem = memory_get_usage() / 1024;\n echo \"Request: $i\\n\";\n echo \"Memory: $mem KiB\\n\";\n echo \"Real Memory: $kmem KiB\\n\";\n }\n);\n\n$socket->listen(1337);\n\n$loop->run();\n```\n\nTesting my server with 1k concurrent connections: `siege localhost:1337 --concurrent=1000` I get the following:\n\n```\nint(759) //gc_collect_cycles\nRequest: 1229\nMemory: 10426.96875 KiB\nReal Memory: 14336 KiB\nint(1081) //gc_collect_cycles\nRequest: 1229\nMemory: 10314.3515625 KiB\nReal Memory: 14080 KiB\nint(0) //gc_collect_cycles\nRequest: 1229\nMemory: 10314.3515625 KiB\nReal Memory: 14336 KiB\n```\n\nEverything is good, but I've noticed that the used memory doesn't drop after ending the siege. I would expect a memory clean up after all the requests are resolved. \n","author":{"url":"https://github.com/unusorin","@type":"Person","name":"unusorin"},"datePublished":"2013-07-29T11:16:28Z","url":"https://github.com/reactphp/reactphp/issues/217"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:78499e46-4caa-4bdf-3f89-71af487715a6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E02C:3A347:235976:304A49:6B00C0E5 |
| html-safe-nonce | eb4114ea14fbd190224ca57ef80f57a7327bc0d614c9bfb50cfb4527724b4dad |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDJDOjNBMzQ3OjIzNTk3NjozMDRBNDk6NkIwMEMwRTUiLCJ2aXNpdG9yX2lkIjoiNDk5NjYwMDA3MDE2NzExODA1MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a895acab8109ccc427c0c5de54a95971601b1d62242aa8c01eefd90b45b2d72c |
| hovercard-subject-tag | issue:17334247 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/reactphp/reactphp/217/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6d0293b93dbd346e9181f6c3b9d7895cc9d60878eb056ff257e8519a9ebe1856/reactphp/reactphp/issues/217 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6d0293b93dbd346e9181f6c3b9d7895cc9d60878eb056ff257e8519a9ebe1856/reactphp/reactphp/issues/217 |
| og:image:alt | Hi, I was playing with the examples and I noticed something weird with https://github.com/reactphp/react/blob/master/examples/test-memory-http.php. I was trying to test how React handles many concu... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | unusorin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 93edd3bebc4afb7ce711ee74cb5d2a95927850b082a4d43e212222389cb1c415 |
| turbo-cache-control | no-preview |
| go-import | github.com/reactphp/reactphp git https://github.com/reactphp/reactphp.git |
| octolytics-dimension-user_id | 1696866 |
| octolytics-dimension-user_login | reactphp |
| octolytics-dimension-repository_id | 4287921 |
| octolytics-dimension-repository_nwo | reactphp/reactphp |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 4287921 |
| octolytics-dimension-repository_network_root_nwo | reactphp/reactphp |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1fee81a280ea86312b69448e261b418189bfd5b5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width