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.