memory.h 639 字节
Newer Older
W
wangguibao 已提交
1 2 3 4
#ifndef BAIDU_PADDLE_SERVING_PREDICTOR_MEMORY_H
#define BAIDU_PADDLE_SERVING_PREDICTOR_MEMORY_H

#include "common/inner_common.h"
W
wangguibao 已提交
5
#include "mempool/mempool.h"
W
wangguibao 已提交
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

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