-
Notifications
You must be signed in to change notification settings - Fork 109
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 leak #115
Comments
Hi @scottschafer! Im facing the same issue, can u please provide an example of ur hacky |
@scottschafer how did you do to get the leaks that way? memLeak in EncounterView@711833 | 11 | 1360 % | 100 001 32852 % |
To @liquidprogrammer , the fix looked something like this in the template:
Where EncounterView is the react2angular component. Then when changing states away from this route, I set includeEncounterView to false and wait until the view is torn down before proceeding to the route.
@brianunlam, It's been a while since I looked at this. SInce I reported this bug, I discovered that React seems to hang onto references and free them periodically. This means that you might need to take a memory snapshot, perform an operation that shouldn't leak and then WAIT before taking another snapshot - if you do this too quickly, you might see leaks that don't really exist. But in this case, it did seem like the memory was steadily increasing. I don't know, this leak/non-leak was driving me a little bit crazy. Now I have code that I'm afraid to touch. ;) I asked about React hanging onto references here BTW: Thanks for a great and useful library. I don't think it's the culprit here. |
@scottschafer hi, thanks! I'll try that out. I didn't try to |
I don't know if this is at all an issue with react2angular, but I am experiencing some nasty leaks with a React component wrapped with react2angular. I have a workaround listed at the end, but it's ugly and I'd like to find a better solution.
My component looks like this:
Then this component is embedded into my AngularJS app like this, hooked up with
$stateProvider.state
:The problem here is that when I go to this route and leave it,
componentWillUnmount()
is called but the buffer is not released.Here are the retainers:
However, I did find a workaround. Which is nasty. The fix was to use
ng-if
to remove the component when changing the route. If I do that, then the buffer is released.I don't like this solution though. Any ideas as to what's happening?
The text was updated successfully, but these errors were encountered: