Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Memory Leak in ZipHandler

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #19312 |

    I’m still testing your component an found out, that your .NET Zip Component has in Xceed.Zip.ZipHandler a Hashtable named mg_zipHandlerTable. This Member is static private and stores MemoryStreams. I will use my ZipComponent for a service that zip’s/unzipp’s around 500 Zip Files a day and should run 24/7.

    How can i free this Memory?



    Imported from legacy forums. Posted by mstruggl (had 2341 views)

    User (Old forums)
    Post count: 23064

    Hello mstruggl.

    This hashtable contains ZipHandler instances that manage and synchronize access to a single zip file. Let’s say you have the following code:
    DiskFile zipFile = new DiskFile( @”d:\backup.zip” );

    ZippedFile fileInZip = new ZippedFile( zipFile, “picture.bmp” );
    ZippedFolder folderInZip = new ZippedFolder( zipFile, “data” );
    ZippedFile otherFileInZip = folderInZip.GetFile( “database.mdb” );

    All these instances use the same “AbstractFile” as the actual zip file. But “ZIP” intelligence isn’t in a DiskFile instance. What happens is when you create the first instance of a ZippedFile, ZippedFolder or ZipArchive (the root ZippedFolder), a “ZipHandler” is searched in the mg_zipHandlerTable, using (a variation of) the provided AbstractFile as the key. If not found, a new ZipHandler instance is created.

    This way, any ZippedFile, ZippedFolder or ZipArchive instance working with the same AbstractFile can safely affect the same zip file. We decided not to make ZippedFile, ZippedFolder (and ZipArchive) IDisposable, for compatibility with other derived classes of AbstractFile or AbstractFolder. That means the ZipHandler will get removed from the hashtable only when the last instance using that AbstractFile will get garbage collected.

    Now, make sure to use the latest version, as versions before 2.0.108 had a bug causing ZipHandler not to get removed at all!

    Imported from legacy forums. Posted by Martin (had 3521 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.