forked from teamnwah/openmw-tes3coop
Very minor changes.
git-svn-id: https://openmw.svn.sourceforge.net/svnroot/openmw/trunk@30 ea6a568a-9f4f-0410-981a-c910a81bb256
This commit is contained in:
parent
3c1e340aac
commit
eb642d3400
3 changed files with 6 additions and 19 deletions
|
@ -228,7 +228,7 @@ struct HashTable(Key, Value, Alloc = GCAlloc, Hash = DefHash,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look up a value. If found return true, otherwise false.
|
// Look up a value. If found return true, otherwise false.
|
||||||
bool inList(Key k) { return lookup(k) != null; }
|
bool inList(Key k) { return lookupKey(k) != null; }
|
||||||
|
|
||||||
// Look up a value. If found return pointer, otherwise null.
|
// Look up a value. If found return pointer, otherwise null.
|
||||||
Value* lookup(Key k)
|
Value* lookup(Key k)
|
||||||
|
|
|
@ -64,12 +64,12 @@ abstract class Record
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Allocate objects of this class (and all subclasses) in the
|
||||||
|
// nifRegion. This means we can allocate and deallocate the entire
|
||||||
|
// nif tree very quickly, without involving the GC, and with zero
|
||||||
|
// chance of memory leaks or heap fragmentation.
|
||||||
new(uint sz)
|
new(uint sz)
|
||||||
{
|
{
|
||||||
// After eliminating all GC dependence, this is no longer
|
|
||||||
// needed.
|
|
||||||
//return nifRegion.allocateGC(sz).ptr;
|
|
||||||
|
|
||||||
return nifRegion.allocate(sz).ptr;
|
return nifRegion.allocate(sz).ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,14 +37,6 @@ class RegionManagerException : Exception
|
||||||
{ super( format("Memory Region Manager '%s': %s", name, msg ) ); }
|
{ super( format("Memory Region Manager '%s': %s", name, msg ) ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// I tried this as an inner class, and it didn't even remotely work. I
|
|
||||||
// think inner class support in DMD sucks quite a bit. Works ok now
|
|
||||||
// (but still had some problems - template support in general is still
|
|
||||||
// pretty patchy.)
|
|
||||||
|
|
||||||
// UPDATE: The above comment was written a long time ago, it might
|
|
||||||
// work now. But if it ain't broke, don't fix it.
|
|
||||||
|
|
||||||
// A resizable array using a region for memory allocation. These can
|
// A resizable array using a region for memory allocation. These can
|
||||||
// safely be resized back and forth without wasting large amounts of
|
// safely be resized back and forth without wasting large amounts of
|
||||||
// memory.
|
// memory.
|
||||||
|
@ -179,7 +171,7 @@ class RegionManager
|
||||||
// Use a default buffer size of one meg. Might change later.
|
// Use a default buffer size of one meg. Might change later.
|
||||||
const uint defaultBufferSize = 1024*1024;
|
const uint defaultBufferSize = 1024*1024;
|
||||||
|
|
||||||
// The size to use for new buffer.
|
// The size to use for new buffers.
|
||||||
uint bufferSize;
|
uint bufferSize;
|
||||||
|
|
||||||
// Current amount of space that is 'lost' in unused end-of-buffer
|
// Current amount of space that is 'lost' in unused end-of-buffer
|
||||||
|
@ -205,11 +197,6 @@ class RegionManager
|
||||||
// large enough to prevent this from being necessary in most cases.
|
// large enough to prevent this from being necessary in most cases.
|
||||||
void nextBuffer()
|
void nextBuffer()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if(currentBuffer != 0)
|
|
||||||
writefln("WARNING: adding new buffer, number ", currentBuffer);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// We should never have to increase the number of buffers!
|
// We should never have to increase the number of buffers!
|
||||||
if(currentBuffer >= buffers.length) fail("Out of buffers");
|
if(currentBuffer >= buffers.length) fail("Out of buffers");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue