1
votes

For example, in local network, when Adobe Air is reading files from local server (\\Server\storage\) and network will be in down for a second, Air becomes eat a lot of memory and it is increasing up to 1GB (while normal memory use is 100 kb or less). Just reading file with File('file path on local server'); from unstable network can cause this error. Have anybody seen that in projects?

  private function init() : void
  {
    file = new File("\\Server\dragracing\results.txt");
    fileStream = new FileStream();
    fileStream.addEventListener( Event.COMPLETE, fileComplete );
    fileStream.openAsync( file, FileMode.READ );
  }
  private function fileComplete( event : Event ):void
  {
    fileContents = fileStream.readMultiByte( fileStream.bytesAvailable, ISO_CS );
    .....
  }
]]>
1
You mind showing your code? It could be your code instead of Air that's causing a severe memory leak.J_A_X

1 Answers

0
votes

Have you tried closing the FileStream in the fileComplete method? Call the close method to make that happen.

private function fileComplete( event : Event ):void { fileContents = fileStream.readMultiByte( fileStream.bytesAvailable, ISO_CS ); fileStream.close(); ..... }

Also, based on your code it does not appear that you are ever actually reading information in from the file. from the file; so it is not clear the complete method will ever execute. There are plenty of methods used to read information in using the FileStream class.