~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/memory/root.cc

  • Committer: patrick crews
  • Date: 2011-02-23 17:17:25 UTC
  • mto: (2195.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2196.
  • Revision ID: gleebix@gmail.com-20110223171725-4tgewemxhsw1m7q8
Integrated randgen with dbqp.  We now have mode=randgen and a set of randgen test suites (very basic now).  Output = same as dtr : )  We also have mode=cleanup to kill any servers we have started.  Docs updates too.  Gendata utility allows us to populate test servers 

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/internal/my_sys.h>
 
24
#include <drizzled/internal/m_string.h>
25
25
 
26
26
#include <algorithm>
27
27
 
257
257
  return((void*) start);
258
258
}
259
259
 
260
 
#define TRASH_MEM(X) TRASH(((char*)(X) + ((X)->size-(X)->left)), (X)->left)
 
260
static void trash_mem(memory::internal::UsedMemory *)
 
261
{
 
262
  TRASH(((char*)(x) + (x->size - x->left)), x->left);
 
263
}
261
264
 
262
265
/**
263
266
 * @brief
273
276
  for (next= free; next; next= *(last= &next->next))
274
277
  {
275
278
    next->left= next->size - ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
276
 
    TRASH_MEM(next);
 
279
    trash_mem(next);
277
280
  }
278
281
 
279
282
  /* Combine the free and the used list */
283
286
  for (; next; next= next->next)
284
287
  {
285
288
    next->left= next->size - ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
286
 
    TRASH_MEM(next);
 
289
    trash_mem(next);
287
290
  }
288
291
 
289
292
  /* Now everything is set; Indicate that nothing is used anymore */
336
339
  {
337
340
    this->free=this->pre_alloc;
338
341
    this->free->left=this->pre_alloc->size-ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
339
 
    TRASH_MEM(this->pre_alloc);
 
342
    trash_mem(this->pre_alloc);
340
343
    this->free->next=0;
341
344
  }
342
345
  this->block_num= 4;