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

fix(module:image): resolve memory leak #6856

Merged
merged 1 commit into from
Nov 2, 2021

Conversation

arturovt
Copy link
Member

@arturovt arturovt commented Jul 13, 2021

PR Checklist

PR Type

[x] Bugfix

What is the current behavior?

Currently, event listeners are not removed from the image element when the directive is destroyed, tho they keep capturing this and prevent the directive from being GC'd.

__ngContext__[2] & 256 is lView[FLAGS] & LViewFlags.Destroyed, which checks if the directive is in destroyed status (it is):

image

The image preview can be closed by clicking on the close button on either container. This means that one of the streams will emit (containerClick or closeClick). If containerClick emits, then the closeClick will never complete and vice-versa:

image

What is the new behavior?

The NzImageDirective is GC'd successfully.

Does this PR introduce a breaking change?

[x] No

@zorro-bot
Copy link

zorro-bot bot commented Jul 13, 2021

This preview will be available after the AzureCI is passed.

@codecov
Copy link

codecov bot commented Jul 13, 2021

Codecov Report

Merging #6856 (5689483) into master (f89cb38) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 5689483 differs from pull request most recent head e8bd36e. Consider uploading reports for the commit e8bd36e to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6856   +/-   ##
=======================================
  Coverage   89.52%   89.52%           
=======================================
  Files         489      489           
  Lines       15802    15806    +4     
  Branches     2572     2572           
=======================================
+ Hits        14146    14150    +4     
  Misses       1015     1015           
  Partials      641      641           
Impacted Files Coverage Δ
components/image/image-preview-ref.ts 100.00% <100.00%> (ø)
components/image/image.directive.ts 90.66% <100.00%> (+0.25%) ⬆️
components/time-picker/time-holder.ts 94.73% <0.00%> (-1.06%) ⬇️
components/modal/modal-container.ts 92.89% <0.00%> (+0.54%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f89cb38...e8bd36e. Read the comment docs.

@simplejason simplejason merged commit 6744eb1 into NG-ZORRO:master Nov 2, 2021
@arturovt arturovt deleted the fix/image-leak branch November 2, 2021 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants