Pregunta

I am trying to port tcmalloc to uclibc. Tcmalloc has a definition for sbrk function, which in turn calls the __sbrk from libc. Uclibc on the other hand does not have __sbrk function, but has sbrk.

Any ideas about how I can call uclibc sbrk from tcmalloc sbrk?

¿Fue útil?

Solución

sbrk is a (old) system call, but most memory allocators are built above mmap. See also this question

You should use the syscall, not emulate it. And I would prefer using mmap, not sbrk

Doing a system call (usually mmap) is the only way to get more memory from the linux kernel.

From the application's (or library's) point of view, a system call is atomic (it is mostly a single machine instruction like SYSCALL, SYSENTER, int 0x80 etc.).

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top