Skip to content

Commit

Permalink
Fix memory leaks on OpenWrt static builds for kernels with madvise
Browse files Browse the repository at this point in the history
  • Loading branch information
klzgrad committed Oct 18, 2024
1 parent 20c282e commit 89e03e4
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,9 @@ void DiscardSystemPagesInternal(uintptr_t address, size_t length) {
}
PA_PCHECK(ret == 0);
#elif defined(NO_MADVISE_SYSCALL)
static_cast<void>(ptr);
static_cast<void>(length);
// The kernel may be missing madvise support, but
// if the kernel does support it, should call it to avoid memory leaking.
static_cast<void>(madvise(ptr, length, MADV_DONTNEED));
#else // PA_BUILDFLAG(IS_APPLE)
// We have experimented with other flags, but with suboptimal results.
//
Expand Down

0 comments on commit 89e03e4

Please sign in to comment.