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

Memory Leak #35

Closed
chentsulin opened this issue Aug 19, 2015 · 0 comments
Closed

Memory Leak #35

chentsulin opened this issue Aug 19, 2015 · 0 comments

Comments

@chentsulin
Copy link
Collaborator

If objects don't release reference when they unmount, it will cause memory leak.

A class which show and hide element according to state can easily demonstrate this, like below:

export default class myClass extends Component {
  constructor(props, context) {
    super(props, context);
    this.state = {
      isHidden: false
    };
  }
  componentDidMount() {
    setInterval(() => {
      this.setState({
        isHidden: !this.state.isHidden
      });
    }, 10);
  }
  render() {
    return (
      this.state.isHidden ? null : <CodeEditor />
    );
  }
}

Some minutes later, will like this:

Memory Leak

securingsincity added a commit that referenced this issue Aug 22, 2015
fix #35, release ref when will unmount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant