Just a small update.

I ran my little program here on my dev machine Win7 x64 8GB RAM and it
fails at 57MB which is still well below the 2GB threshold i expected.
So I changed it to go directly through esent and bypass all the PHT
stuff and it sill fails.
I'm going to try putting something on the esent issue and maybe
twitter to see if I can find anything else out.

Does anyone else have any ideas?

Thanks

---
testing directly with esent:
        private static void UseEsentDirectly(byte[] requestData)
                {
                        var database = "test.ess";
                         var path = database;
            if (Path.IsPathRooted(database) == false)
                path = Path.Combine
(AppDomain.CurrentDomain.BaseDirectory, database);

            database = Path.Combine(path, Path.GetFileName(database));
                        var instance = new Instance(database + "_" + 
Guid.NewGuid());
 instance.Parameters.CircularLog = true;
            instance.Parameters.CreatePathIfNotExist = true;
            instance.Parameters.TempDirectory = Path.Combine(path,
"temp");
            instance.Parameters.SystemDirectory = Path.Combine(path,
"system");
            instance.Parameters.LogFileDirectory = Path.Combine(path,
"logs");
                          instance.Init();

                        EnsureDatabaseIsCreatedAndAttachToDatabase(instance, 
database);

                        using(var session = new Session(instance))
                        {
                                var tx = new Transaction(session);

                                JET_DBID dbid;
                                Api.JetOpenDatabase(session, database, null, 
out dbid,
OpenDatabaseGrbit.None);

                                var data = new Table(session, dbid, "data", 
OpenTableGrbit.None);
                                var dataColumns = 
Api.GetColumnDictionary(session, data);

                                using (var update = new Update(session, data, 
JET_prep.Insert))
                                {
                                                        Api.SetColumn(session, 
data, dataColumns["key"], "Hello",
Encoding.Unicode);
                                Api.SetColumn(session, data, 
dataColumns["version_number"], 1);
                                Api.SetColumn(session, data, 
dataColumns["version_instance_id"],
new byte[]{0xFF});
                                        Api.SetColumn(session, data, 
dataColumns["data"], requestData);
                                        update.Save();
                                }

                                tx.Commit(CommitTransactionGrbit.None);


                                if (data != null)
                                {
                                        data.Dispose();
                                }

                                if (Equals(dbid, JET_DBID.Nil) == false)
                                {
                                        Api.JetCloseDatabase(session, dbid, 
CloseDatabaseGrbit.None);
                                }

                                if (tx != null)
                                {
                                        tx.Dispose();
                                }
                        }

                }

                 private static void EnsureDatabaseIsCreatedAndAttachToDatabase
(Instance instance, string database)
        {
            using (var session = new Session(instance))
            {
                try
                {
                    Api.JetAttachDatabase(session, database,
AttachDatabaseGrbit.None);
                    return;
                }
                catch (EsentErrorException e)
                {
                    if (e.Error != JET_err.FileNotFound)
                        throw;
                }

                new SchemaCreator(session).Create(database);
                Api.JetAttachDatabase(session, database,
AttachDatabaseGrbit.None);
            }
        }


On Aug 6, 7:01 am, chrisortman <[email protected]> wrote:
> I wrote a small app to test (which i will paste the main below) but so
> the problem seems to be machine specific.
> I have a windows 2003x64 VM (vmware) with 4 GB ram and when I run this
> program it will consistently fail at 31MB of data.
>
> On any non virtual machine I have run it on it will go past that 31MB
> limit
>
> Anyone have any ideas?
> Thanks
>
> ----- Main.cs
> namespace MaximumOfflineDataSize {
>         using System.IO;
>         using System;
>
>         using Rhino.PersistentHashTable;
>
>         class Program {
>                 static void Main(string[] args) {
>                         log4net.Config.XmlConfigurator.Configure();
>                         var output = log4net.LogManager.GetLogger(typeof 
> (Program));
>
>                         var sizeInMB = 1;
>                         var maxSizeInMB = 2;
>
>                         /*
>                          * Arguments:
>                          * If 1 argument then it is the max size
>                          * If 2 arguments then the first is the start and the 
> 2nd is the
> max
>                          */
>
>                         if(args.Length == 2)
>                         {
>                                 sizeInMB = Convert.ToInt32(args[0]);
>                                 maxSizeInMB = Convert.ToInt32(args[1]);
>                         }
>                         else if(args.Length == 1)
>                         {
>                                 maxSizeInMB = Convert.ToInt32(args[0]);
>                         }
>
>                         if(Directory.Exists("test.cache"))
>                         {
>                                 Directory.Delete("test.cache", true);
>                         }
>
>                         var pht = new PersistentHashTable("test.cache");
>                         pht.Initialize();
>                         output.Info("Created PHT");
>
>                         while(sizeInMB <= maxSizeInMB)
>                         {
>                                 var data = CreateDataArray(sizeInMB);
>
>                                 try
>                                 {
>                                         pht.Batch(actions =>
>                                         {
>                                                 actions.Put(new PutRequest()
>                                                 {
>                                                         Key = 
> "test-data-"+sizeInMB,
>                                                         Bytes = data,
>                                                         ParentVersions = new 
> ValueVersion[0]
>                                                 });
>
>                                                 actions.Commit();
>                                         });
>
>                                         output.InfoFormat("Successfully wrote 
> data of {0} MB", sizeInMB);
>                                 }
>                                 catch (Exception ex)
>                                 {
>                                         output.InfoFormat("Failed to write 
> data of size {0} MB",
> sizeInMB);
>                                         output.Info("Error was", ex);
>                                         break;
>                                 }
>                                 finally
>                                 {
>                                         sizeInMB += 1;
>                                         data = null;
>                                 }
>                         }
>
>                         Console.WriteLine("Finished, Press [ENTER] to quit");
>                         Console.ReadLine();
>                 }
>
>                 static byte[] CreateDataArray(int sizeInMB)
>                 {
>                         return new byte[sizeInMB*1000000];
>                 }
>
>         }
>
> }
>
> On Aug 5, 9:09 pm, Ayende Rahien <[email protected]> wrote:
>
>
>
> > It should be possible to put up to 2GB, can you create a test case?
>
> > On Thu, Aug 6, 2009 at 4:44 AM, Chris Ortman <[email protected]> wrote:
>
> > > Has any one run into any size limitations when putting data into the
> > > pht? I am trying to do a put with 37 mb of data and geTting event out
> > > of memory errors
>
> > > --
> > > Sent from my mobile device
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to