~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/memory/root.h

  • Committer: Olaf van der Spek
  • Date: 2011-06-22 19:56:58 UTC
  • mto: This revision was merged to the branch mainline in revision 2347.
  • Revision ID: olafvdspek@gmail.com-20110622195658-h9jn0gtyng4f2ne2
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
/* move used to free list and reuse them */
41
41
static const int MARK_BLOCKS_FREE= 2;
42
42
 
43
 
namespace internal {
44
 
 
45
 
class UsedMemory
46
 
{                          /* struct for once_alloc (block) */
47
 
public:
48
 
  UsedMemory *next;        /* Next block in use */
49
 
  size_t left;             /* memory left in block  */            
50
 
  size_t size;             /* size of block */
51
 
};
52
 
 
 
43
namespace internal 
 
44
{
 
45
  class UsedMemory
 
46
  {                        /* struct for once_alloc (block) */
 
47
  public:
 
48
    UsedMemory *next;      /* Next block in use */
 
49
    size_t left;                   /* memory left in block  */            
 
50
    size_t size;                   /* size of block */
 
51
  };
53
52
}
54
53
 
55
54
static const size_t ROOT_MIN_BLOCK_SIZE= (MALLOC_OVERHEAD + sizeof(internal::UsedMemory) + 8);
57
56
class DRIZZLED_API Root
58
57
{
59
58
public:
60
 
 
61
59
  Root() :
62
60
    free(0),
63
61
    used(0),
135
133
} /* namespace memory */
136
134
} /* namespace drizzled */
137
135
 
 
136
inline void* operator new(size_t size, drizzled::memory::Root& root)
 
137
{
 
138
  return root.alloc(size);
 
139
}
 
140