memory.h 631 字节
Newer Older
W
wangguibao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#ifndef BAIDU_PADDLE_SERVING_PREDICTOR_MEMORY_H
#define BAIDU_PADDLE_SERVING_PREDICTOR_MEMORY_H

#include "common/inner_common.h"
#include "mempool.h"

namespace baidu {
namespace paddle_serving {
namespace predictor {

class MempoolWrapper {
public:
    MempoolWrapper() {}

    static MempoolWrapper& instance() {
        static MempoolWrapper mempool;
        return mempool;
    }

    int initialize();

    int thread_initialize();

    int thread_clear();

    void* malloc(size_t size);

private:
    im::fugue::memory::Region _region;
    THREAD_KEY_T _bspec_key;
};

} // predictor
} // paddle_serving
} // baidu

#endif