Skip to content

Commit

Permalink
remove sysconf from malloc critical path
Browse files Browse the repository at this point in the history
  • Loading branch information
JiakunYan committed Jan 26, 2024
1 parent f69a119 commit 4db6c87
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lci/sys/lciu_malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ static inline void* LCIU_memalign(size_t alignment, size_t size)
{
void* p_ptr;
int ret = posix_memalign(&p_ptr, alignment, size);
LCI_Assert(
ret == 0, "posix_memalign(%lu, %lu) returned %d (Free memory %lu/%lu)\n",
alignment, size, ret, sysconf(_SC_AVPHYS_PAGES) * sysconf(_SC_PAGESIZE),
sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE));
if (ret != 0) {
LCI_Assert(
false, "posix_memalign(%lu, %lu) returned %d (Free memory %lu/%lu)\n",
alignment, size, ret, sysconf(_SC_AVPHYS_PAGES) * sysconf(_SC_PAGESIZE),
sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE));
}
return p_ptr;
}
static inline void LCIU_free(void* ptr) { free(ptr); }
Expand Down

0 comments on commit 4db6c87

Please sign in to comment.