title: Objective C @autoreleasepool infinite loop taking screenshots
body: <p>I have a memory issue with small app taking infinite amount of screenshots every X milliseconds and displaying them in a imageview. Even with autorelease, it floods the memory very quickly. Here's the code:</p>
  
  <pre><code>- (void)draw {
      do {
          @autoreleasepool {
              CGImageRef image1 = CGDisplayCreateImage(kCGDirectMainDisplay);
  
              NSBitmapImageRep *bitmapRep = [[NSBitmapImageRep alloc] initWithCGImage:image1];
              NSImage *image = [[NSImage alloc] init];
              [image addRepresentation:bitmapRep];
              _imageView.image = image;
              [NSThread sleepForTimeInterval:1];
          }
      }while(true);
  }
  </code></pre>
  
  <p>Any ideas?</p>