Memory allocation

Most eCos system calls expect you to pass the address of pre-allocated memory for the objects created in that system call. This is frequently the preferred way of doing things for embedded applications, where programmers want to allocate all memory statically and have fine control over that resource.

In contrast, some eCos system calls also allow a NULL pointer to be passed. In such a case the kernel will allocate the memory or select default size. This feature is not supported in the current release, and a warning flag is placed in the documentation for those routines (like cyg_thread_create()).

eCos provides dynamic memory allocation, based on memory pools, a useful and flexible approach to memory management inspired by the µITRON compatibility layer. These are described in the section called Memory pools in Chapter 5.

If you configure your system to use the Standard C Library you can also use the standard malloc() library call.