Fixing issue #2 - memory allocation in iOS