Annotate anonymous mmap

Use PR_SET_VMA_ANON_NAME to set human-readable names for anonymous
virtual memory areas mapped by `mmap()` when compiled and run on Linux
5.17 or higher.  This makes it convenient for developers to debug mmap.
This commit is contained in:
Kunshan Wang 2024-11-19 16:07:22 +08:00 committed by Peter Zhu
parent 640bacceb1
commit 8ae7c22972
Notes: git 2024-11-21 18:48:28 +00:00
10 changed files with 100 additions and 5 deletions

View file

@ -16,6 +16,7 @@
#include "internal/array.h"
#include "internal/bits.h"
#include "internal/error.h"
#include "internal/gc.h"
#include "internal/numeric.h"
#include "internal/string.h"
#include "internal/io.h"
@ -83,6 +84,8 @@ io_buffer_map_memory(size_t size, int flags)
if (base == MAP_FAILED) {
rb_sys_fail("io_buffer_map_memory:mmap");
}
ruby_annotate_mmap(base, size, "Ruby:io_buffer_map_memory");
#endif
return base;