ashmem

SHM replacement based on ASHMEM

情到浓时终转凉″ 提交于 2019-12-22 17:59:12
问题 I'm working on a library port from *nix to Android, and the library uses shared memory or shm . Android does not have System V shm . Instead it uses ashmem . Is anyone aware of a shim library to map shm calls into ashmem ? Google has not been very helpful. 回答1: This is how it worked for me while working with a similar problem of porting: Instead of using shmfd = open(SHM_PATH, O_RDWR) for creating and getting file descriptor I replaced it with int fd = ashmem_create_region("SharedRegionName",

What's the data in dalvik-LinearAlloc, dalvik-aux-structure, dalvik-bitmap-1, dalvik-bitmap-2, dalvik-card-table, dalvik-mark-stack and dalvik-zygote?

对着背影说爱祢 提交于 2019-12-21 01:45:24
问题 I use showmap command on a PID, and I can't understand this part in the report: 16384 3752 689 0 3132 0 620 4 /dev/ashmem/dalvik-LinearAlloc (deleted) 2460 1748 934 0 828 0 920 18 /dev/ashmem/dalvik-aux-structure (deleted) 8192 572 572 0 0 0 572 1 /dev/ashmem/dalvik-bitmap-1 (deleted) 8192 0 0 0 0 0 0 1 /dev/ashmem/dalvik-bitmap-2 (deleted) 4100 312 312 0 0 0 312 1 /dev/ashmem/dalvik-card-table (deleted) 502140 14860 14860 0 0 0 14860 3 /dev/ashmem/dalvik-heap (deleted) 1500 280 280 0 0 0 280

Shared memory region in NDK

梦想的初衷 提交于 2019-12-19 10:47:22
问题 I want to have a shared memory block (an ashmem region) that's mapped and accessed from native code. I also want this block to be used by several applications. I also want it to work on SDK level 7 (Android 2.1) There are two routes. I can create an ashmem region in native code; but then the question is - how do I pass an integer file descriptor to another process? You can marshal FileDescriptor objects via a Parcel , but there's no way to construct one around a raw FD. There's also

sharing a buffer between a Java service and a native app with minimal access overhead

廉价感情. 提交于 2019-12-12 11:17:55
问题 I am trying to set up a shared memory region between an Android Java service and a native process. The native process has no Java component, is purely C++, and is invoked from the shell directly by a command line. I believe that I can use ashmem and binder to accomplish this. First call ashmem_create_region, call mmap on the result, then pass the resulting fd to the other process using binder. The other process does mmap on the fd and thereby gains access to the shared region. I understand

Cutils not included in NDK?

爷,独闯天下 提交于 2019-12-12 08:45:27
问题 I need to use cutils library and headers to implement ashmem on my NDK project but I could not find anything related to cutils in my system. Where is it located or from where can I obtain it? 回答1: The Android "cutils" library, found in the sources at system/core/libcutils, is not part of the NDK. The code there changes with every release, so it's not something you can rely on. The best approach for now is to copy the source for the relevant portions of the library into your project. 回答2: If

What's the data in dalvik-LinearAlloc, dalvik-aux-structure, dalvik-bitmap-1, dalvik-bitmap-2, dalvik-card-table, dalvik-mark-stack and dalvik-zygote?

半腔热情 提交于 2019-12-03 08:49:24
I use showmap command on a PID, and I can't understand this part in the report: 16384 3752 689 0 3132 0 620 4 /dev/ashmem/dalvik-LinearAlloc (deleted) 2460 1748 934 0 828 0 920 18 /dev/ashmem/dalvik-aux-structure (deleted) 8192 572 572 0 0 0 572 1 /dev/ashmem/dalvik-bitmap-1 (deleted) 8192 0 0 0 0 0 0 1 /dev/ashmem/dalvik-bitmap-2 (deleted) 4100 312 312 0 0 0 312 1 /dev/ashmem/dalvik-card-table (deleted) 502140 14860 14860 0 0 0 14860 3 /dev/ashmem/dalvik-heap (deleted) 1500 280 280 0 0 0 280 1 /dev/ashmem/dalvik-jit-code-cache (deleted) 174764 0 0 0 0 0 0 1 /dev/ashmem/dalvik-mark-stack

Shared memory region in NDK

喜欢而已 提交于 2019-12-01 12:55:24
I want to have a shared memory block (an ashmem region) that's mapped and accessed from native code. I also want this block to be used by several applications. I also want it to work on SDK level 7 (Android 2.1) There are two routes. I can create an ashmem region in native code; but then the question is - how do I pass an integer file descriptor to another process? You can marshal FileDescriptor objects via a Parcel , but there's no way to construct one around a raw FD. There's also ParcelFileDescriptor which supports constructing around and retrieving integer FD's, but the relevant methods

Writing to ashmem / why does android free ashmem?

柔情痞子 提交于 2019-11-27 06:16:13
问题 I want to share data between two (ndk-)processes. For this I use ashmem using this source. One process is continuously reading ( read_mem ) and one process is writing one time ( write_mem ). The problem is that the read process is not getting the values of the writer. AND By watching the maps of the reader I found that android deletes the shared memory file right after ashmem_create_region . read_mem.c // read_mem.c #include <stdio.h> #include <errno.h> #include <sys/mman.h> #include "ashmem