79419165

Date: 2025-02-06 19:52:20
Score: 3.5
Natty:
Report link

This is rather inefficient, though, as I'm allocating an entire page (4KB) for everything I JIT, most of which only need a few bytes. (Note that my concern is more with the amount of page mappings, and possibly falling afoul of vm.max_map_count, than just the raw amount of RAM used.) For regular memory allocation, malloc takes care of this by wrapping (s)brk and mmap and keeping track of what parts of the page are used. I obviously can't just use malloc because it allocates non-executable memory. Is there a simple way to get similar behavior when allocating executable memory, or would I have to use a custom replacement for malloc to do this? This is rather inefficient, though, as I'm allocating an entire page (4KB) for everything I JIT, most of which only need a few bytes. (Note that my concern is more with the amount of page mappings, and possibly falling afoul of vm.max_map_count, than just the raw amount of RAM used.) For regular memory allocation, malloc takes care of this by wrapping (s)brk and mmap and keeping track of what parts of the page are used. I obviously can't just use malloc because it allocates non-executable memory. Is there a simple way to get similar behavior when allocating executable memory, or would I have to use a custom replacement for malloc to do this? This is rather inefficient, though, as I'm allocating an entire page (4KB) for everything I JIT, most of which only need a few bytes. (Note that my concern is more with the amount of page mappings, and possibly falling afoul of vm.max_map_count, than just the raw amount of RAM used.) For regular memory allocation, malloc takes care of this by wrapping (s)brk and mmap and keeping track of what parts of the page are used. I obviously can't just use malloc because it allocates non-executable memory. Is there a simple way to get similar behavior when allocating executable memory, or would I have to use a custom replacement for malloc to do this? This is rather inefficient, though, as I'm allocating an entire page (4KB) for everything I JIT, most of which only need a few bytes. (Note that my concern is more with the amount of page mappings, and possibly falling afoul of vm.max_map_count, than just the raw amount of RAM used.) For regular memory allocation, malloc takes care of this by wrapping (s)brk and mmap and keeping track of what parts of the page are used. I obviously can't just use malloc because it allocates non-executable memory. Is there a simple way to get similar behavior when allocating executable memory, or would I have to use a custom replacement for malloc to do this? This is rather inefficient, though, as I'm allocating an entire page (4KB) for everything I JIT, most of which only need a few bytes. (Note that my concern is more with the amount of page mappings, and possibly falling afoul of vm.max_map_count, than just the raw amount of RAM used.) For regular memory allocation, malloc takes care of this by wrapping (s)brk and mmap and keeping track of what parts of the page are used. I obviously can't just use malloc because it allocates non-executable memory. Is there a simple way to get similar behavior when allocating executable memory, or would I have to use a custom replacement for malloc to do this?

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Ends in question mark (2):
  • Unregistered user (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: goat