title: Releasing C Library (With ARC)
body: <p>I am currently using <code>rtmpdump</code> as a C program inside my iOS application. However, I cannot seem to use it more than once without having to restart the application. What could be the cause of this and how can I fix it?</p>
  
  <p>Relevant Code: </p>
  
  <pre><code>NSDictionary *details = [args objectAtIndex:0]; //rtmpe deatils
  NSString *flvStore = [args objectAtIndex:1];
  NSString *mp4Store = [args objectAtIndex:2];
  [self performSelectorOnMainThread:@selector(updateProgressBar:) withObject:flvPath waitUntilDone:NO];
  [self getFlashFile:details withFlvPathName:flvStore];
  
  NSFileManager *fileManager = [NSFileManager defaultManager];
  if([fileManager fileExistsAtPath:flvPath]){
      NSNumber *filesize = 0;
      NSDictionary *fileAttributes = [[NSFileManager defaultManager] fileAttributesAtPath:flvPath traverseLink:NO];
      if(fileAttributes != nil){
          filesize = [fileAttributes objectForKey:NSFileSize];
      }
  
      if([filesize longLongValue] &gt; 1024){
          [self removeFlvWrapper:flvPath withMp4PathName:mp4Path andTitle:[thePid objectForKey:@"title"]];
      }
      [fileManager removeItemAtPath:flvPath error:NULL];
  }
  </code></pre>
  
  <hr>
  
  <pre><code>- (void)getFlashFile:(NSDictionary *)details withFlvPathName:(NSString *)flvPath {
  static char **rt_argv;
  static int    rt_argc;
  
  rt_argc = 16;
  rt_argv = (char **)malloc(sizeof(char *) * (rt_argc));
  rt_argv[0] = "rtmpdump";
  rt_argv[1] = (char *)[@"-r" UTF8String];
  rt_argv[2] = (char *)[[details objectForKey:@"r"] UTF8String];
  rt_argv[3] = (char *)[@"-a" UTF8String];
  rt_argv[4] = (char *)[[details objectForKey:@"a"] UTF8String];
  rt_argv[5] = (char *)[@"-f" UTF8String];
  rt_argv[6] = (char *)[@"WIN 10,0,32,18" UTF8String];
  rt_argv[7] = (char *)[@"-W" UTF8String];
  rt_argv[8] = (char *)[[details objectForKey:@"W"] UTF8String];
  rt_argv[9] = (char *)[@"-p" UTF8String];
  rt_argv[10] = (char *)[[details objectForKey:@"p"] UTF8String];
  rt_argv[11] = (char *)[@"-y" UTF8String];
  rt_argv[12] = (char *)[[details objectForKey:@"y"] UTF8String];
  rt_argv[13] = (char *)[@"-o" UTF8String];
  rt_argv[14] = (char *)[flvPath UTF8String];
  rt_argv[15] = (char *)[@"-q" UTF8String];
  
  getStream(rt_argc, rt_argv);
  finished = true;
  }
  </code></pre>
  
  <p>You can also look at the <a href="https://github.com/BigBadOwl/iStreamer-Download-Manager/blob/master/iplayerFetch.m" rel="nofollow">BigBadOwl repository under iPlayerFetch.m</a> to see similar code.</p>