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

Cache nonParameterCharacterSet to help minimize memory footprint in multithreaded apps using SOCKit. #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bsuvorov
Copy link

@bsuvorov bsuvorov commented Jul 6, 2015

TLDR:
Purpose of this pull request is to minimize memory spikes in processes using SOCKin in parallel threads. Objective is achieved by caching nonParameterCharacterSet. Footprint of single nonParameterCharacterSet is slightly more than 32KB.

More info:
Facts

  1. iOS today extensions are limited to use 10-11MB of the heap for iPhone 5 - iPhone 6 plus
  2. As you can see from attached image of Allocations utility, one call to nonParameterCharacterSet takes up north of 32KB. (all of these allocations in the attached image are related to single call).

Details on actual usage
One of the iOS "today extensions" I'm working with has Reskit + SOCKit stack and is issuing a bunch of networking requests + CoreData object creation in parallel. Such parallel behavior leads to significant spike of memory usage with SOCKit pattern creation consuming a lot of memory during this short spike.
Having this patch helps minimize this spike during user interacting with extension and prolong life of the extension in memory.

screen shot 2015-07-05 at 10 14 50 pm

bsuvorov pushed a commit to robinhoodmarkets/sockit that referenced this pull request Jul 7, 2015
…ultithreaded apps using SOCKit

Relevant github.com pull request into SOCKit is located here: NimbusKit#26
bsuvorov pushed a commit to robinhoodmarkets/sockit that referenced this pull request Jul 7, 2015
…multithreaded environments

Relevant github.com pull request into SOCKit is located here: NimbusKit#26
@balazsnemeth
Copy link

Could you plaase merge this? I'm totally in the same situation.

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

Successfully merging this pull request may close these issues.

2 participants