NSAutoreleasePool in ios
iOS AutoreleasePool
- It is a predifine interface or class which is avilable in foundation framework.
- Pool is a object of type NSAutoreleasePool which holds reference of pool memory.
- By using ‘alloc’ method we are creating pool of memory for current application.
- By using ‘init’ method, dynamically created memory will initialize.
- ‘drain’ is a predifined method by using this method we are deallocating dynamically created pool memory. Ex. #import<Foundation/Foundation.h> int main(int argc, const char *argv[]) { @autoreleasepool{ int a,b; NSLog(@”Enter 2 values”); scanf(“%d %d”,&a,&b); NSLog(@”Sum of %d + %d = %d”,a,b,a+b); } }
|
iOS AutoreleasePool |
No comments:
Post a Comment