Skip to content

Commit

Permalink
fix memory align bug
Browse files Browse the repository at this point in the history
  • Loading branch information
idealvin committed Dec 9, 2023
1 parent 61ddc7a commit fb9d9c8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ class GlobalAlloc {
GlobalAlloc() = default;
~GlobalAlloc();

struct alignas(64) X {
struct alignas(co::cache_line_size) X {
X() : mtx(), hb(0) {}
std::mutex mtx;
union {
Expand Down Expand Up @@ -657,8 +657,8 @@ class alignas(co::cache_line_size) ThreadAlloc {


static int g_nifty_counter;
char g_root_buf[sizeof(Root)];
Root& g_root = *(Root*)g_root_buf;
struct alignas(Root) { char _[sizeof(Root)]; } g_root_buf;
Root& g_root = *(Root*)&g_root_buf;
static GlobalAlloc* g_ga;
__thread ThreadAlloc* g_ta;

Expand Down

0 comments on commit fb9d9c8

Please sign in to comment.