~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/memory/root.cc

  • Committer: Olaf van der Spek
  • Date: 2011-03-29 12:04:36 UTC
  • mto: (2257.1.1 build) (2276.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: olafvdspek@gmail.com-20110329120436-vozkuer8vqgh027p
Always call assert()

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * Routines to handle mallocing of results which will be freed the same time 
19
19
 */
20
20
 
21
 
#include "config.h"
 
21
#include <config.h>
22
22
 
23
 
#include "drizzled/internal/my_sys.h"
24
 
#include "drizzled/internal/m_string.h"
 
23
#include <drizzled/definitions.h>
 
24
#include <drizzled/memory/root.h>
 
25
#include <drizzled/internal/my_sys.h>
 
26
#include <drizzled/internal/m_string.h>
25
27
 
26
28
#include <algorithm>
27
29
 
257
259
  return((void*) start);
258
260
}
259
261
 
260
 
#define TRASH_MEM(X) TRASH(((char*)(X) + ((X)->size-(X)->left)), (X)->left)
261
 
 
262
262
/**
263
263
 * @brief
264
264
 * Mark all data in blocks free for reusage 
273
273
  for (next= free; next; next= *(last= &next->next))
274
274
  {
275
275
    next->left= next->size - ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
276
 
    TRASH_MEM(next);
277
276
  }
278
277
 
279
278
  /* Combine the free and the used list */
283
282
  for (; next; next= next->next)
284
283
  {
285
284
    next->left= next->size - ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
286
 
    TRASH_MEM(next);
287
285
  }
288
286
 
289
287
  /* Now everything is set; Indicate that nothing is used anymore */
336
334
  {
337
335
    this->free=this->pre_alloc;
338
336
    this->free->left=this->pre_alloc->size-ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
339
 
    TRASH_MEM(this->pre_alloc);
340
337
    this->free->next=0;
341
338
  }
342
339
  this->block_num= 4;