0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

minor mmf

This commit is contained in:
Dwight 2010-04-06 18:05:30 -04:00
parent 3cfeda9c91
commit 977e246702
2 changed files with 10 additions and 6 deletions

View File

@ -110,9 +110,12 @@ namespace mongo {
void printMemInfo( const char * where );
//#include "ramstore.h"
// typedef RamStoreFile MMF;
//#define _RAMSTORE
#if defined(_RAMSTORE)
#include "ramstore.h"
typedef RamStoreFile MMF;
#else
typedef MemoryMappedFile MMF;
#endif
} // namespace mongo

View File

@ -20,7 +20,7 @@
class RamStoreFile : public MongoFile {
char name[256];
struct Node {
void *p;
char *p;
int len;
Node() : len(0) { }
};
@ -32,12 +32,13 @@ class RamStoreFile : public MongoFile {
Node& n = _m[offset];
if( n.len == 0 ) {
// create
cout << "CREATE ofs:" << offset << " len:" << maxLen << endl;
cout << "CREATE " << name << " ofs:" << offset << " len:" << maxLen << endl;
assert( maxLen >= 0 );
n.p = calloc(maxLen+1, 1);
n.p = (char *) calloc(maxLen+1, 1);
n.len = maxLen;
}
assert( n.len >= maxLen );
assert( n.p[n.len] == 0 );
return n.p;
}