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

perf(table): leaking reference through mostRecentCellOutlet #12269

Merged
merged 1 commit into from
Jul 29, 2018

Conversation

crisbeto
Copy link
Member

Fixes the table leaking out a reference to a cell outlet via the CdkCellOutlet.mostRecentCellOutlet after all tables have been destroyed.

Fixes #12259.

Fixes the table leaking out a reference to a cell outlet via the `CdkCellOutlet.mostRecentCellOutlet` after all tables have been destroyed.

Fixes angular#12259.
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Jul 18, 2018
@crisbeto crisbeto requested a review from andrewseguin as a code owner July 18, 2018 20:09
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 18, 2018
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker perf This issue is related to performance labels Jul 18, 2018
crisbeto added a commit to crisbeto/material2 that referenced this pull request Jul 23, 2018
Along the same lines as angular#12269. Clears out the `mostRecentTreeNode` once the last tree node is destroyed, in order to avoid a memory leak.
mmalerba pushed a commit that referenced this pull request Jul 24, 2018
Along the same lines as #12269. Clears out the `mostRecentTreeNode` once the last tree node is destroyed, in order to avoid a memory leak.
@mmalerba mmalerba merged commit 34a7e38 into angular:master Jul 29, 2018
mmalerba pushed a commit that referenced this pull request Jul 30, 2018
Along the same lines as #12269. Clears out the `mostRecentTreeNode` once the last tree node is destroyed, in order to avoid a memory leak.
mmalerba pushed a commit that referenced this pull request Jul 30, 2018
Fixes the table leaking out a reference to a cell outlet via the `CdkCellOutlet.mostRecentCellOutlet` after all tables have been destroyed.

Fixes #12259.
@JamieMcI
Copy link

JamieMcI commented Aug 3, 2018

6.4.2 is generating this error when navigating from the page that I believe might be from this update.
Error: Uncaught (in promise): TypeError: o.ngOnDestroy is not a function

My Table setup (no issues in 6.4.1)
` <table mat-table #costs [dataSource]="dataSourceExp" class="mat-elevation-z8">

    <ng-container matColumnDef="type">
        <th mat-header-cell *matHeaderCellDef> Type </th>
        <td mat-cell *matCellDef="let expRow"> {{expRow.type}} </td>
    </ng-container>

    <ng-container matColumnDef="result">
        <th mat-header-cell *matHeaderCellDef class="table-number"> Result </th>
        <td mat-cell *matCellDef="let expRow" class="table-number"> {{expRow.result | number}} </td>
    </ng-container>

    <ng-container matColumnDef="calculated">
        <th mat-header-cell *matHeaderCellDef class="table-number"> Calculated </th>
        <td mat-cell *matCellDef="let expRow" class="table-number"> {{expRow.calculated | number}} </td>
    </ng-container>

    <ng-container matColumnDef="difference">
        <th mat-header-cell *matHeaderCellDef class="table-number"> Difference </th>
        <td mat-cell *matCellDef="let expRow" class="table-number"> {{ expRow.result - expRow.calculated === 0 ? '' : expRow.result - expRow.calculated | number }} </td>
    </ng-container>

    <tr mat-header-row *matHeaderRowDef="displayedExpColumns"></tr>
    <tr mat-row *matRowDef="let expRow; columns: displayedExpColumns;">
    </tr>
</table>`

@crisbeto
Copy link
Member Author

crisbeto commented Aug 3, 2018

@JamieMcI just looking at the stack trace, it doesn't look like something coming from Material. At least in the table, we don't have any explicit calls to ngOnDestroy. If you can put together an example of it breaking I can take a look. You can fork some of the examples from the docs site as a starting point.

@JamieMcI
Copy link

Having trouble putting together an example, so I apologize if this isn't helpful. Wanted to give a quick update. Referencing this Stack overflow I set my build-optimizer = false. This fixed the issue.

The reason I reference this here is because 6.4.2 introduced the problem and the commit for this issue implements a new ngOnDestroy. This could just be my code base when the optimizer tries to combine the new code in 6.4.2 with my project. Not super clear on how the optimizer works.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement perf This issue is related to performance target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

minor memory leak in cdk table
6 participants