Skip to content

Commit

Permalink
fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
lqxhub committed Dec 17, 2024
1 parent 0aed015 commit 7b864f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/pika_client_conn.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class PikaClientConn : public net::RedisConn {

std::shared_ptr<TimeStat> time_stat_;

void SetMemoryPool(net::MemoryPool *memory_pool) override{ memory_pool_ = memory_pool; }
void SetMemoryPool(net::MemoryPool* memory_pool) override { memory_pool_ = memory_pool; }

private:
net::ServerThread* const server_thread_;
Expand All @@ -131,7 +131,7 @@ class PikaClientConn : public net::RedisConn {
bool authenticated_ = false;
std::shared_ptr<User> user_;

net::MemoryPool *memory_pool_;
net::MemoryPool *memory_pool_= nullptr;

std::variant<std::shared_ptr<Cmd>, Cmd*> DoCmd(const PikaCmdArgsType& argv, const std::string& opt,
const std::shared_ptr<std::string>& resp_ptr, bool cache_miss_in_rtc);
Expand Down
4 changes: 2 additions & 2 deletions src/net/src/memory_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ class MemoryPool {
}

auto index = *page;
bits_ &= ~(1ull << index);
bits_.fetch_and(~(1ull << index));
}

private:
template <typename T, typename... Args>
T *AllocateExtend(Args &&...args) {
auto newPage = std::malloc(sizeof(T) + pageOffset_);
auto newPage = std::aligned_alloc(alignof(T), sizeof(T) + pageOffset_);
auto page = reinterpret_cast<uint8_t *>(newPage);
*page = extendFlag_; // Set the page head to 0xFF
return new (++page) T(std::forward<Args>(args)...);
Expand Down

0 comments on commit 7b864f9

Please sign in to comment.