File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -88,12 +88,13 @@ grow_thread_array(struct _qsbr_shared *shared)
8888 // Overallocate by 63 bytes so we can align to a 64-byte boundary.
8989 // This avoids potential false sharing between the first entry and other
9090 // allocations.
91- size_t alloc_size = (size_t )new_size * sizeof (struct _qsbr_pad ) + 63 ;
91+ size_t alignment = 64 ;
92+ size_t alloc_size = (size_t )new_size * sizeof (struct _qsbr_pad ) + alignment - 1 ;
9293 void * raw = PyMem_RawCalloc (1 , alloc_size );
9394 if (raw == NULL ) {
94- return -1 ;
95- }
96- struct _qsbr_pad * array = _Py_ALIGN_UP (raw , 64 );
95+ return -1 ;
96+ }
97+ struct _qsbr_pad * array = _Py_ALIGN_UP (raw , alignment );
9798
9899 void * old_raw = shared -> array_raw ;
99100 if (shared -> array != NULL ) {
You can’t perform that action at this time.
0 commit comments