Welcome to the Xceed Community | Help
Community Search  

MemUsage skyrockets when unzipping files

Sort Posts: Previous Next
  •  09-10-2008, 11:53 AM Post no. 15136

    MemUsage skyrockets when unzipping files

    Here is my code:

     

    private void ExtractToTempFolder(string sourcePath)
            {
                ZipArchive fileAsZip = new ZipArchive(new DiskFile(sourcePath));
                MemoryFolder folder = new MemoryFolder("MemoryDrive", @"\");
                fileAsZip.CopyFilesTo(folder, true, true);

                MemoryFolder subFolder = folder.GetFolder(@"path omitted here") as MemoryFolder;

                DiskFolder tempFolder = new DiskFolder(tempDirectory);
                subFolder.CopyFilesTo(tempFolder, true, true, new NameFilter("filter omitted here - but gets 8 files from the folder"));
            }

     

    I am taking a ZIP file, and extracting out 8 files to a physical directory on my PC.

    When this runs, it's like it doesn't release the memory.  So when I watch my app in Task Manager, MemUsage just keeps going up every time this method is called. 

    Any suggestions?

  •  09-11-2008, 11:49 AM Post no. 15177 in reply to 15136

    Re: MemUsage skyrockets when unzipping files

    Your issue is specific to you, and we would need to reproduce it to understand the what's happening.  However this would require us to invest time on it, and for us to allocate time on your issue would require you to have an active vanguard support subscription, which you can contact our sales department at sales@xceed.com for more information.  If you already are a vanguard subscriber, please send us an email at support@xceed.com.

    Alternatively your post will remain on the forums viewable to the community to comment and suggest solutions.


     

     


    André
    Software Developer and Tech Support
    Xceed Software Inc.
  •  09-30-2008, 10:32 AM Post no. 15746 in reply to 15177

    Re: MemUsage skyrockets when unzipping files

    We investigated this further through an email thread with Hillarie.  We found that MemoryFolder and MemoryFile need to be erased after being done with them, and calling the Garbage Collector will release the memory.  The reason for this is that MemoryFolder and MemoryFile are implemented a bit like a file on disk, that it, if you set a reference to a DiskFile to null, the file will still exist on disk, you can reference it later in your application.  If you make a new MemoryFolder with the same name later in your application, the folder (and files in it) will be there.

    Here is an example of what needs to be done :

    static void MemoryFolderTest()
    {
      MemoryFolder folder = new MemoryFolder( "MemoryDrive", "\\" );
      DiskFile file = new DiskFile( @"someFile" ); // in this case, a 3.89MB file

      for( int i = 0; i < 100; i++ )
      {
        file.CopyTo( folder.GetFile( i.ToString() ), true );
      }

      file = null;

      for( int i = 0; i < 100; i++ )
      {
        folder.GetFile( i.ToString() ).Delete();
      }

      folder = null;

      GC.Collect();
    }


    André
    Software Developer and Tech Support
    Xceed Software Inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.