Adjust mem attr for load data
This commit is contained in:
15
deps/oblib/src/lib/hash/ob_array_hash_map.h
vendored
15
deps/oblib/src/lib/hash/ob_array_hash_map.h
vendored
@ -51,14 +51,14 @@ public:
|
||||
ObArrayHashMap(): lock_(common::ObLatchIds::HASH_MAP_LOCK), size_(0), capacity_(0), items_(NULL) {}
|
||||
~ObArrayHashMap() { destroy(); }
|
||||
|
||||
int init(const lib::ObLabel &label, int64_t capacity)
|
||||
int init(const lib::ObMemAttr attr, int64_t capacity)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (!label.is_valid() || capacity <= 0) {
|
||||
if (capacity <= 0) {
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
} else if (is_inited()) {
|
||||
ret = OB_INIT_TWICE;
|
||||
} else if (NULL == (items_ = static_cast<Item *>(ob_malloc(capacity * sizeof(Item), label)))) {
|
||||
} else if (NULL == (items_ = static_cast<Item *>(ob_malloc(capacity * sizeof(Item), attr)))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
} else {
|
||||
capacity_ = capacity;
|
||||
@ -67,6 +67,13 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int init(const lib::ObLabel label, int64_t capacity)
|
||||
{
|
||||
ObMemAttr attr;
|
||||
attr.label_ = label;
|
||||
return init(attr, capacity);
|
||||
}
|
||||
|
||||
void destroy()
|
||||
{
|
||||
if (NULL != items_) {
|
||||
@ -129,7 +136,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int64_t to_string(char *buf, int64_t buf_len) const
|
||||
{
|
||||
int64_t pos = 0;
|
||||
|
||||
8
deps/oblib/src/lib/string/ob_sql_string.h
vendored
8
deps/oblib/src/lib/string/ob_sql_string.h
vendored
@ -37,7 +37,13 @@ public:
|
||||
virtual ~ObSqlString();
|
||||
|
||||
bool is_valid() const;
|
||||
void set_label(const lib::ObLabel &label) { allocator_.set_label(label); }
|
||||
void set_attr(const lib::ObMemAttr &attr) { allocator_.set_attr(attr); }
|
||||
void set_label(const lib::ObLabel &label)
|
||||
{
|
||||
lib::ObMemAttr attr;
|
||||
attr.label_ = label;
|
||||
allocator_.set_attr(attr);
|
||||
}
|
||||
void reset();
|
||||
void reuse();
|
||||
int reserve(const int64_t size);
|
||||
|
||||
Reference in New Issue
Block a user