-
Notifications
You must be signed in to change notification settings - Fork 49
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
Memory usage #22
Comments
Woops! You are right... should do some corrections. |
We have a project where we use multiple servers as sources for streaming and the client combines the segments received from the different servers and feed the HTML5 player with the result using the MSE extension. Unfortunately, Apple decided not to implement MSE on iOS. As a workaround, we tried to use a local webserver as a proxy and implement the logic for combining the segments and provide the result as HTTP Live Streaming for the HTML5 player. And it was easy to use your plugin for a quick test. I also had to make a small modification to support specifying the Content-Type instead of using hard coded text/html for this to work. Since I only need it on iOS, I don't have a general solution to make it working on all platforms. |
@kukukk sick...
There is no general solution... one have to fix it in the code for android and iOS. |
Yeah, it's kinda' sick :}, but since Apple forces every third-party browser to use the built-in WebKit rendering engine we don't really have a choice, if we want to support iOS... I have some experiences with Android, so I will try to have a look at the Android part too. But I can't promise it. Btw, I had a quick look at NanoHTTPDWebserver.java and it seems that this.webserver.responses is not cleaned either. |
Yes, that's why I said :)
Just pull out the response from this.webserver.responses. It should do the trick on the iOS sources too |
Hi! Unfortunately, it seems to be more complicated. When I try to remove the handled response from this.webserver.responses it make the app to crash. I tried to different ways: When "We got the dict so put information in the response" use
Before "Complete the async response"
I also tried to just mark the response as handled by
but it also makes the app to crash. I think it is because I'm trying to manipulate the dictionary in different threads. Unfortunately, I have no experiences with Swift to make it thread-safe. I will try to find a solution, but, if you have some time, it would be greatly appreciated some help :} |
I tried to implement a basic thread-safe Dictionary implementation, which seems to work. You can have a look at it here: https://github.com/kukukk/cordova-plugin-webserver/commit/29ab495aadd22c46af1501cc9eb620a0bf6a43cd |
@kukukk looks good, can you make a pull request to merge it in here? |
One more observation: |
What is the status of this issue? Has everything what has been discussed here been fixed or are there still some todo's left? |
@boedy |
Hi!
When I played with the project on iOS I encountered some memory issues. I think it was because in Webserver.swift you never empty the self.responses variable. I used the webserver to forward files having a few MB in size and it caused the high memory usage. Maybe you should do some proper cleanup and after the request is processed remove it from self.responses.
The text was updated successfully, but these errors were encountered: