wangzhengquan
2020-09-25 00dba6082e245d917cb7d6eed3c627211ff41cd7
src/queue/include/shm_allocator.h
@@ -1,7 +1,7 @@
#ifndef __SHM_ALLOCATOR_H__
#define __SHM_ALLOCATOR_H__
#include "usg_common.h"
#include "mm.h"
#include "mem_pool.h"
#include <new>
#include <cstdlib> // for exit()
#include <climits> // for UNIX_MAX
@@ -66,13 +66,13 @@
class SHM_Allocator {
  public:
    static void *allocate (size_t size) {
       printf("shm_allocator malloc\n");
      return mm_malloc(size);
      // return mem_pool_malloc(size);
    }
    static void deallocate (void *ptr) {
      printf("shm_allocator free\n");
      return mm_free(ptr);
      // return mem_pool_free(ptr);
    }
};
@@ -80,12 +80,10 @@
class DM_Allocator {
  public:
    static void *allocate (size_t size) {
      printf("dm_allocator malloc\n");
      return malloc(size);
    }
    static void deallocate (void *ptr) {
      printf("dm_allocator free\n");
      return free(ptr);
    }
};
@@ -97,6 +95,6 @@
typedef std::basic_string<char, std::char_traits<char>, SHM_STL_Allocator<char> > shmstring;
typedef std::basic_string<char, std::char_traits<char>, SHM_STL_Allocator<char> > SHMString;
#endif