Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaking memory problem #54

Closed
ghost opened this issue May 16, 2018 · 2 comments
Closed

Leaking memory problem #54

ghost opened this issue May 16, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented May 16, 2018

We capture images from the iPad camera and want to send these data back to the client. The image >5MB large. In Xcode and also Instruments we see that the memory used by the app is increasing by roughly 5MB whenever we trigger a request on the web server. Instruments shows us that there are some memory leaks in the http request. Maybe the objects are not released. The code looks similar to your demo template. Only the body data is larger and instead of an image we use a simple Data object with the same size like an camera image.

let loop = try! SelectorEventLoop(selector: try! SelectSelector())
let server = DefaultHTTPServer(eventLoop: loop, interface: "127.0.0.1", port: self.port) {
 (
   environ: [String: Any],
   startResponse: ((String, [(String, String)]) -> Void),
   sendBody: ((Data) -> Void)
 ) in
 startResponse("200 OK", [])
 sendBody(Data(String(repeating: "A", count: 5427471).utf8))
 sendBody(Data())   // send EOF
}
try! server.start() 
loop.runForever()
@ghost ghost closed this as completed Jun 7, 2018
@fangpenlin
Copy link
Contributor

Hi @agriesert, thanks for reporting this. Sorry I got too busy recently had no time to check this issue. And just saw you close it, is it resolved or are you still experiencing the same problem?

@marimelon
Copy link

I also having the same problem.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants