kernelsauce / turbo

Turbo is a framework built for LuaJIT 2 to simplify the task of building fast and scalable network applications. It uses a event-driven, non-blocking, no thread design to deliver excellent performance and minimal footprint to high-load applications while also providing excellent support for embedded uses.
http://turbo.readthedocs.io/
Apache License 2.0
525 stars 84 forks source link

remove ffi.gc for http_parser_url #366

Open gary8520 opened 11 months ago

gary8520 commented 11 months ago

luajit may manage http_parser_url struct directly instead of managing a struct http_parser_url * and a block of struct http_parser_url instance.

MarcoChen97 commented 11 months ago

this change can fix the following test case by the luajit 2.0.5

self.request.headers.http_parser_url = nil
print("[Debug] url field:", self.request.headers:get_url_field(turbo.httputil.UF.PATH))

collectgarbage("collect")
print("[Debug] url field:", self.request.headers:get_url_field(turbo.httputil.UF.PATH))

before adding this change, the second print cannot get the value since the data seems to be freed by lua GC.

gary8520 commented 3 months ago

@kernelsauce is there any comment about the PR?