Changeset 28a0887 in rtems


Ignore:
Timestamp:
Feb 10, 2012, 9:36:26 AM (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
3b18c26
Parents:
6491f67
git-author:
Sebastian Huber <sebastian.huber@…> (02/10/12 09:36:26)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/10/12 09:42:58)
Message:

Added support functions for greedy heap allocation

Various tests must check program paths that result due to failed memory
allocations from the heap. To avoid tinkering with internal heap
structures throughout the test code these functions should be used.

Location:
cpukit
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/Makefile.am

    r6491f67 r28a0887  
    108108    src/rtems_memalign.c src/malloc_deferred.c src/malloc_sbrk_helpers.c \
    109109    src/malloc_dirtier.c src/malloc_p.h src/rtems_malloc.c \
    110     src/rtems_heap_extend.c
     110    src/rtems_heap_extend.c \
     111    src/rtems_heap_greedy.c
    111112
    112113PASSWORD_GROUP_C_FILES = src/getpwent.c
  • cpukit/libcsupport/include/rtems/malloc.h

    r6491f67 r28a0887  
    185185);
    186186
     187/**
     188 * @brief Greedy allocate that empties the heap.
     189 *
     190 * Afterward the heap has at most @a remaining_free_space free space left in
     191 * one free block.  All other blocks are used.
     192 *
     193 * @see rtems_heap_greedy_free().
     194 */
     195void *rtems_heap_greedy_allocate( size_t remaining_free_space );
     196
     197/**
     198 * @brief Frees space of a greedy allocation.
     199 *
     200 * The @a opaque argument must be the return value of
     201 * rtems_heap_greedy_allocate().
     202 */
     203void rtems_heap_greedy_free( void *opaque );
     204
    187205#ifdef __cplusplus
    188206}
  • cpukit/score/Makefile.am

    r6491f67 r28a0887  
    182182libscore_a_SOURCES += src/heap.c src/heapallocate.c src/heapextend.c \
    183183    src/heapfree.c src/heapsizeofuserarea.c src/heapwalk.c src/heapgetinfo.c \
    184     src/heapgetfreeinfo.c src/heapresizeblock.c src/heapiterate.c
     184    src/heapgetfreeinfo.c src/heapresizeblock.c src/heapiterate.c \
     185    src/heapgreedy.c
    185186
    186187## OBJECT_C_FILES
  • cpukit/score/include/rtems/score/heap.h

    r6491f67 r28a0887  
    550550
    551551/**
     552 * @brief Greedy allocate that empties the heap.
     553 *
     554 * Afterward the heap has at most @a remaining_free_space free space left in
     555 * one free block.  All other blocks are used.
     556 *
     557 * @see _Heap_Greedy_free().
     558 */
     559Heap_Block *_Heap_Greedy_allocate(
     560  Heap_Control *heap,
     561  uintptr_t remaining_free_space
     562);
     563
     564/**
     565 * @brief Frees blocks of a greedy allocation.
     566 *
     567 * The @a blocks must be the return value of _Heap_Greedy_allocate().
     568 */
     569void _Heap_Greedy_free(
     570  Heap_Control *heap,
     571  Heap_Block *blocks
     572);
     573
     574/**
    552575 * @brief Returns information about used and free blocks for the heap @a heap
    553576 * in @a info.
Note: See TracChangeset for help on using the changeset viewer.