logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

hal_malloc - Allocate space in the HAL shared memory area

Arguments

size   Gives the size, in bytes, of the block.

Description

hal_malloc  allocates  a  block of memory from the main HAL shared memory area.  It should be used by all
       components to allocate memory for HAL pins and parameters.  It allocates  `size'  bytes,  and  returns  a
       pointer  to the allocated space, or NULL (0) on error.  The returned pointer will be properly aligned for
       any type HAL supports.  A component should allocate during initialization all the memory it needs.

       The allocator is very simple, and there is no `free'.  The entire HAL shared memory area  is  freed  when
       the  last component calls hal_exit.  This means that if you continuously install and remove one component
       while other components are present, you eventually will fill up the shared memory  and  an  install  will
       fail.  Removing all components completely clears memory and you start fresh.

Name

       hal_malloc - Allocate space in the HAL shared memory area

Return Value

       A  pointer to the allocated space, which is properly aligned for any variable HAL supports.  Returns NULL
       on error.

LinuxCNC Documentation                             2006-10-12                                   hal_malloc(3hal)

Syntax


               void *hal_malloc(long int size)

See Also