This is Unofficial EPICS BASE Doxygen Site
osdPoolStatus.c File Reference
#include <rtems/malloc.h>
#include "osiPoolStatus.h"
+ Include dependency graph for osdPoolStatus.c:

Go to the source code of this file.

Functions

LIBCOM_API int epicsStdCall osiSufficentSpaceInPool (size_t contiguousBlockSize)
 Checks if a memory block of a specific size can be safely allocated. More...
 

Function Documentation

LIBCOM_API int epicsStdCall osiSufficentSpaceInPool ( size_t  contiguousBlockSize)

Checks if a memory block of a specific size can be safely allocated.

The meaning of "safely allocated" is target-specific, some additional free space is usually necessary to keep the system running reliably. On vxWorks this returns True if at least 100000 bytes is free.

Note
This routine is called quite frequently by the IOC so an efficent implementation is important.
Parameters
contiguousBlockSizeBlock size to check.
Returns
True if the requested memory should be available.

Definition at line 17 of file osdPoolStatus.c.

18 {
19  rtems_malloc_statistics_t s;
20  unsigned long n;
21 
22  malloc_get_statistics(&s);
23  n = s.space_available - (unsigned long)(s.lifetime_allocated - s.lifetime_freed);
24  return (n > (50000 + contiguousBlockSize));
25 }