Allocating and using ashmem works well:
ashmemFD = open("/dev/ashmem", O_RDWR);
int ret = ioctl(ashmemFD, ASHMEM_SET_NAME, "vf");
ioctl(ashmemFD, ASHMEM_SET_SIZE, size);
ashmap = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, ashmemFD, 0);
But the question is, is it enough to just unmap it after use, or do I need to do more to release the memory again?
munmap((void*) ashmap,size);