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 fix and cancel connection timeout timer in scheduleCleanup. #525

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Jul 20, 2017

  1. Memory leak fix and cancel connection timeout timer in scheduleCleanup.

    This Pull Request fixes two issues:
    1. Uses weak SRWebSocket object in the block of `_readUntilHeaderCompleteWithCallback`. Since consumers has a `_completion` block which will retain SRWebSocket instance, if we uses strong self, cycle reference will occur.
    To Reproduce this issue, just simply connect an invalid website, e.g. ws:://echo111.websocket111.org111 , set a breakpoint in `SRWebSocket:dealloc`, it will never go there. This bug was found by analyzing 'Allocation List' in the `Instruments` tool of Xcode.
    
    2. Should cancel connection timeout timer in scheduleCleanup method, otherwise, the 'dealloc' method will be invoked only after the time (default: 60s) have come, which may cause memory increase.
    Since `dispatch_after` could not be cancelled, use `performSelector:withObject:afterDelay` & `cancelPreviousPerformRequestsWithTarget:selector:object` instead.
    James Chen committed Jul 20, 2017
    Configuration menu
    Copy the full SHA
    7f50e05 View commit details
    Browse the repository at this point in the history
  2. Adds missing SRIOConsumerPool:clear method.

    James Chen committed Jul 20, 2017
    Configuration menu
    Copy the full SHA
    a68d756 View commit details
    Browse the repository at this point in the history
  3. fix -Warc-repeated-use-of-weak warning.

    James Chen committed Jul 20, 2017
    Configuration menu
    Copy the full SHA
    a72c597 View commit details
    Browse the repository at this point in the history