Comments (3)
Also, when a stream closes due to error, it seems to automatically reopen again. Is there a way to disable automatic reconnect?
from eventsource.
I think i've found the cause of the problem, but i'm unsure how to fix it at the moment.
It seems impossible to dealloc
an EventSource instance. Even if once disconnected you set it to nil, it does not dealloc.
I've even tried setting the self.listeners array to nil too so it doesn't hold on to any blocks, but still no dealloc.
from eventsource.
Ok, anyone else running into similar problems with this, from the docs for NSURLSession:
Important
The session object keeps a strong reference to the delegate until your app exits or explicitly invalidates the session. If you donβt invalidate the session, your app leaks memory until it exits.
So basically I had to add a property
@property (nonatomic, strong) NSURLSession *session;
Store the session in the _open
function, then in the close
function you have to call
[self.session invalidateAndCancel];
Now EventSource
can dealloc itself and release memory.
from eventsource.
Related Issues (12)
- NSURLRequest timeout HOT 1
- Ignore
- Ignore
- watchOS Support HOT 3
- Cannot install 1.0.4 using Pod HOT 1
- Received data splits if is too long HOT 1
- Memory Leak
- Firebase observer using REST Api
- Crash when using stream(request:) in RequestHandler HOT 1
- If server send a lot of event handler will not get call
- Json breaking while receiving response HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eventsource.