Questions tagged [ashmem]

Ashmem is a linux kernel interface that allows processes which are not related by ancestry to share memory maps by name, which are cleaned up automatically.

Ashmem is a linux kernel interface that allows processes which are not related by ancestry to share memory maps by name, which are cleaned up automatically.

Plain old anonymous mmaps and System V shared memory lack some of these requirements.

23 questions
9
votes
2 answers

Cutils not included in NDK?

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?
eozgonul
  • 810
  • 6
  • 12
7
votes
1 answer

Writing to ashmem / why does android free ashmem?

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…
Eun
  • 4,146
  • 5
  • 30
  • 51
6
votes
1 answer

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?

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 …
Heeten
  • 61
  • 1
  • 3
5
votes
1 answer

android content provider robustness on provider crash

On android platforms (confirmed on ICS), if a content provider dies while a client is in the middle of a query (i.e. has a open cursor) the framework decides to kill the client processes holding a open cursor. Here is a logcat output when i tried…
4
votes
2 answers

How to pass file descriptor to Ashmem between processes

I'm trying to pass file descriptor pointing to a ashmem region from Service (process A) to Activity (process B). In Service I'm puting the native file descriptor to ParcelFileDescriptor and that into a bundle, and I send that via Messenger. However…
Kazuldur
  • 71
  • 1
  • 7
4
votes
1 answer

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

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…
4
votes
2 answers

SHM replacement based on ASHMEM

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…
jww
  • 97,681
  • 90
  • 411
  • 885
3
votes
0 answers

Meaning of /dev/ashmem (deleted) records in process maps

I'm wondering what is the meaning of next records in /proc//maps: ... cdbc2000-cdbc6000 rw-p 00000000 00:04 1290888 /dev/ashmem/dalvik-large object space allocation (deleted) cdbc6000-cdbcf000 rw-p 00000000 00:04…
Sergio
  • 8,099
  • 2
  • 26
  • 52
2
votes
0 answers

Is there any c interface to use Android binders

Basically I need to use shared memory. From this example, I understood that i need to use binders to pass the fd between 2 processes to be able to use shared memory. But my application is in C. So, is there a C interface for using android binders?
Sandeep
  • 18,356
  • 16
  • 68
  • 108
2
votes
1 answer

Ashmem retention policy

So on Android there's neither POSIX shared memory nor SysV shared memory, but there's ashmem. I want to use it to collect some postmortem info from crashes in the native subsystem (like in here). Question - can I make an ashmem region persist when…
Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
1
vote
0 answers

EINVAL when trying write() on a ashmem_create_region fd

I am trying to get a memfd on Android. When I do this all things seem to be okay: int getFd() { ... int fd = syscall(__NR_memfd_create, "none", MFD_CLOEXEC | MFD_ALLOW_SEALING); errno = 0; write(fd, str.c_str(), str.length()); …
Nullptr
  • 11
  • 1
1
vote
2 answers

ashmem giving [Errno 13] Permission denied

In my rooted Android device, jint fd = open("/dev/ashmem",O_RDWR); gives -1 and fopen results in error 13. I've tried changing the permissions as well with chmod 777, but to no avail. Any ideas? Thank you for your help.
1
vote
0 answers

Using Android Nougat's shared memory for media decoding

I am porting my Android AOSP-based distribution from Android K to Android N. It includes a modified version of the Media Player that decodes DVD subtitles. The architecture of the Media Player evolved a lot between those 2 versions. In particular,…
François.CA
  • 311
  • 1
  • 12
1
vote
0 answers

How to use ashmem in native code (without binder)

Is it possible to use ashmem without passing fd through binder? From my android native code, I am forking two different processes. I want to use shared memory between these two processes while they are executing. How can i achieve it?
Sandeep
  • 18,356
  • 16
  • 68
  • 108
1
vote
0 answers

Ashmem slower than files?

I'm looking at using ashmem to help a couple processes coordinate. Before I start spending the effort to use it, I thought I'd see how much of a speedup it offers over a plain 'ol file. try { Random random = new…
James Koppel
  • 1,587
  • 1
  • 10
  • 16
1
2