~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/memory/root.cc

  • Committer: Andrew Hutchings
  • Date: 2011-03-29 20:45:43 UTC
  • mfrom: (2257 drizzle)
  • mto: (2257.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 2258.
  • Revision ID: andrew@linuxjedi.co.uk-20110329204543-ssex0nuo8knncgwx
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
#include <config.h>
22
22
 
 
23
#include <drizzled/definitions.h>
 
24
#include <drizzled/memory/root.h>
23
25
#include <drizzled/internal/my_sys.h>
24
26
#include <drizzled/internal/m_string.h>
25
27
 
257
259
  return((void*) start);
258
260
}
259
261
 
260
 
static void trash_mem(memory::internal::UsedMemory *)
261
 
{
262
 
  TRASH(((char*)(x) + (x->size - x->left)), x->left);
263
 
}
264
 
 
265
262
/**
266
263
 * @brief
267
264
 * Mark all data in blocks free for reusage 
276
273
  for (next= free; next; next= *(last= &next->next))
277
274
  {
278
275
    next->left= next->size - ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
279
 
    trash_mem(next);
280
276
  }
281
277
 
282
278
  /* Combine the free and the used list */
286
282
  for (; next; next= next->next)
287
283
  {
288
284
    next->left= next->size - ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
289
 
    trash_mem(next);
290
285
  }
291
286
 
292
287
  /* Now everything is set; Indicate that nothing is used anymore */
339
334
  {
340
335
    this->free=this->pre_alloc;
341
336
    this->free->left=this->pre_alloc->size-ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
342
 
    trash_mem(this->pre_alloc);
343
337
    this->free->next=0;
344
338
  }
345
339
  this->block_num= 4;