smalloc 1.0
smalloc short from Static memory buffer malloc, is an ideal memory manager for Realtime Linux Kernel modules that can't use dynamic m
|
|||||||||||||||||||
smalloc short from Static memory buffer malloc, is an ideal memory manager for Realtime Linux Kernel modules that can't use dynamic memory offered by kmalloc because of the non-realtime nature of kmalloc.
Like malloc(), smalloc() doles out memory to client code. Unlike malloc, however, smalloc takes a static memory buffer (as an initialization parameter). It is this buffer that smalloc manages when doling out memory to client code.
This design makes smalloc ideal for use inside a Realtime Linux kernel module. It also makes it much easire to port userspace code that relies on malloc() in C or operator new() in C++ for memory management to a realtime kernel module.
For example:
(the below is linux kernel code)
< code >
#include "smalloc.h"
#include < linux/slab.h >
#define MEMPOOLSZ (1024*1024*1024)
char *buf;
...
buf = kmalloc(MEMPOOLSZ, GFP_KERNEL); /* 1 megabyte buffer in kernel
module.. */
smalloc_set_memory_pool(buf, sizeof(buf));
...
MyStruct *s;
s = smalloc(sizeof(MyStruct)); /* example of code that uses this
static memory buffer */
< /code >
The above example is a typical usage pattern of smalloc.
tags
Download smalloc 1.0
Authors software
|
|
Similar software
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Other software in this category
|
|
|
|
|
|
|
|
|
|
Featured Software
jEdit 4.3 pre8
jEdit is an Open Source text editor written in Java
Opera 9.02
Surf the Internet in a safer, faster, and easier way with Opera browser
GNU Aspell 0.60.4
GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell
- Communications
- Database
- Desktop Environment
- Games
- Internet
- Multimedia
- Office
- Programming
- Science and Engineering
- System
- Text Editing&Processing
