本文整理汇总了C#中Btree.AssignOid方法的典型用法代码示例。如果您正苦于以下问题:C# Btree.AssignOid方法的具体用法?C# Btree.AssignOid怎么用?C# Btree.AssignOid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Btree
的用法示例。
在下文中一共展示了Btree.AssignOid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Sweep
private int Sweep()
{
int nDeallocated = 0;
long pos;
gcDone = true;
for (int i = dbFirstUserId, j = committedIndexSize; i < j; i++)
{
pos = GetGCPos(i);
if (pos != 0 && ((int) pos & (dbPageObjectFlag | dbFreeHandleFlag)) == 0)
{
int bit = (int) (SupportClass.URShift(pos, dbAllocationQuantumBits));
if ((blackBitmap[SupportClass.URShift(bit, 5)] & (1 << (bit & 31))) == 0)
{
// object is not accessible
if (GetPos(i) != pos)
{
throw new StorageError(StorageError.INVALID_OID);
}
int offs = (int) pos & (Page.pageSize - 1);
Page pg = pool.GetPage(pos - offs);
int typeOid = ObjectHeader.GetType(pg.data, offs);
if (typeOid != 0)
{
ClassDescriptor desc = FindClassDescriptor(typeOid);
nDeallocated += 1;
if (typeof(Btree).IsAssignableFrom(desc.cls))
{
Btree btree = new Btree(pg.data, ObjectHeader.Sizeof + offs);
pool.Unfix(pg);
btree.AssignOid(this, i, false);
btree.Deallocate();
}
else
{
int size = ObjectHeader.GetSize(pg.data, offs);
pool.Unfix(pg);
FreeId(i);
objectCache.Remove(i);
CloneBitmap(pos, size);
}
if (listener != null)
{
listener.DeallocateObject(desc.cls, i);
}
}
}
}
}
greyBitmap = null;
blackBitmap = null;
allocatedDelta = 0;
gcActive = false;
if (listener != null)
listener.GcCompleted(nDeallocated);
return nDeallocated;
}
示例2: GetMemoryDump
//UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior.
public virtual Hashtable GetMemoryDump()
{
lock (this)
{
lock (objectCache)
{
if (!opened)
{
throw new StorageError(StorageError.STORAGE_NOT_OPENED);
}
int bitmapSize = (int) (SupportClass.URShift(header.root[currIndex].size, (dbAllocationQuantumBits + 5))) + 1;
bool existsNotMarkedObjects;
long pos;
int i, j;
// mark
greyBitmap = new int[bitmapSize];
blackBitmap = new int[bitmapSize];
int rootOid = header.root[currIndex].rootObject;
//UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior.
Hashtable map = new Hashtable();
if (rootOid != 0)
{
MemoryUsage indexUsage = new MemoryUsage(typeof(Index));
MemoryUsage fieldIndexUsage = new MemoryUsage(typeof(FieldIndex));
MemoryUsage classUsage = new MemoryUsage(typeof(Type));
MarkOid(rootOid);
do
{
existsNotMarkedObjects = false;
for (i = 0; i < bitmapSize; i++)
{
if (greyBitmap[i] != 0)
{
existsNotMarkedObjects = true;
for (j = 0; j < 32; j++)
{
if ((greyBitmap[i] & (1 << j)) != 0)
{
pos = (((long) i << 5) + j) << dbAllocationQuantumBits;
greyBitmap[i] &= ~ (1 << j);
blackBitmap[i] |= 1 << j;
int offs = (int) pos & (Page.pageSize - 1);
Page pg = pool.GetPage(pos - offs);
int typeOid = ObjectHeader.GetType(pg.data, offs);
int objSize = ObjectHeader.GetSize(pg.data, offs);
int alignedSize = (objSize + dbAllocationQuantum - 1) & ~ (dbAllocationQuantum - 1);
if (typeOid != 0)
{
MarkOid(typeOid);
ClassDescriptor desc = FindClassDescriptor(typeOid);
if (typeof(Btree).IsAssignableFrom(desc.cls))
{
Btree btree = new Btree(pg.data, ObjectHeader.Sizeof + offs);
btree.AssignOid(this, 0, false);
int nPages = btree.MarkTree();
if (typeof(FieldIndex).IsAssignableFrom(desc.cls))
{
fieldIndexUsage.nInstances += 1;
fieldIndexUsage.totalSize += (long) nPages * Page.pageSize + objSize;
fieldIndexUsage.allocatedSize += (long) nPages * Page.pageSize + alignedSize;
}
else
{
indexUsage.nInstances += 1;
indexUsage.totalSize += (long) nPages * Page.pageSize + objSize;
indexUsage.allocatedSize += (long) nPages * Page.pageSize + alignedSize;
}
}
else
{
//UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior.
MemoryUsage usage = (MemoryUsage) map[desc.cls];
if (usage == null)
{
usage = new MemoryUsage(desc.cls);
map[desc.cls] = usage;
}
usage.nInstances += 1;
usage.totalSize += objSize;
usage.allocatedSize += alignedSize;
if (desc.hasReferences)
{
MarkObject(pool.Get(pos), ObjectHeader.Sizeof, desc);
}
}
}
else
{
classUsage.nInstances += 1;
classUsage.totalSize += objSize;
classUsage.allocatedSize += alignedSize;
}
pool.Unfix(pg);
}
}
//.........这里部分代码省略.........
示例3: Mark
private void Mark()
{
int bitmapSize = (int) (SupportClass.URShift(header.root[currIndex].size, (dbAllocationQuantumBits + 5))) + 1;
bool existsNotMarkedObjects;
long pos;
int i, j;
if (listener != null)
{
listener.GcStarted();
}
greyBitmap = new int[bitmapSize];
blackBitmap = new int[bitmapSize];
int rootOid = header.root[currIndex].rootObject;
if (rootOid != 0)
{
MarkOid(rootOid);
do
{
existsNotMarkedObjects = false;
for (i = 0; i < bitmapSize; i++)
{
if (greyBitmap[i] != 0)
{
existsNotMarkedObjects = true;
for (j = 0; j < 32; j++)
{
if ((greyBitmap[i] & (1 << j)) != 0)
{
pos = (((long) i << 5) + j) << dbAllocationQuantumBits;
greyBitmap[i] &= ~ (1 << j);
blackBitmap[i] |= 1 << j;
int offs = (int) pos & (Page.pageSize - 1);
Page pg = pool.GetPage(pos - offs);
int typeOid = ObjectHeader.GetType(pg.data, offs);
if (typeOid != 0)
{
ClassDescriptor desc = FindClassDescriptor(typeOid);
if (typeof(Btree).IsAssignableFrom(desc.cls))
{
Btree btree = new Btree(pg.data, ObjectHeader.Sizeof + offs);
btree.AssignOid(this, 0, false);
btree.MarkTree();
}
else if (desc.hasReferences)
{
MarkObject(pool.Get(pos), ObjectHeader.Sizeof, desc);
}
}
pool.Unfix(pg);
}
}
}
}
}
while (existsNotMarkedObjects);
}
}