-
Enhancement
-
Resolution: Unresolved
-
P4
-
None
-
None
-
os_x
On macOS we can tag anonymous memory allocated with mmap:
```
MAP_ANON Map anonymous memory not associated with any specific file. The offset argument is ignored. Mac OS X specific: the file descriptor used for creating MAP_ANON regions can be used to pass some Mach VM flags, and can be specified as -1 if no such
flags are associated with the region. Mach VM flags are defined in <mach/vm_statistics.h> and the ones that currently apply to mmap are:
VM_FLAGS_PURGABLE to create Mach purgable (i.e. volatile) memory.
VM_MAKE_TAG(tag) to associate an 8-bit tag with the region.
<mach/vm_statistics.h> defines some preset tags (with a VM_MEMORY_ prefix). Users are encouraged to use tags between 240 and 255. Tags are used by tools such as vmmap(1) to help identify specific memory regions.
```
There is VM_MEMORY_JAVA tag in vm_statistics.h, we can use it.
```
MAP_ANON Map anonymous memory not associated with any specific file. The offset argument is ignored. Mac OS X specific: the file descriptor used for creating MAP_ANON regions can be used to pass some Mach VM flags, and can be specified as -1 if no such
flags are associated with the region. Mach VM flags are defined in <mach/vm_statistics.h> and the ones that currently apply to mmap are:
VM_FLAGS_PURGABLE to create Mach purgable (i.e. volatile) memory.
VM_MAKE_TAG(tag) to associate an 8-bit tag with the region.
<mach/vm_statistics.h> defines some preset tags (with a VM_MEMORY_ prefix). Users are encouraged to use tags between 240 and 255. Tags are used by tools such as vmmap(1) to help identify specific memory regions.
```
There is VM_MEMORY_JAVA tag in vm_statistics.h, we can use it.