source: rtems/cpukit/libcsupport/src/mallocfreespace.c @ ad9255be

4.104.114.9
Last change on this file since ad9255be was ad9255be, checked in by Joel Sherrill <joel.sherrill@…>, on Dec 17, 2007 at 10:36:45 PM

2007-12-17 Joel Sherrill <joel.sherrill@…>

  • libcsupport/Makefile.am, libcsupport/src/mallocfreespace.c: Add malloc_info() routine.
  • libcsupport/src/mallocinfo.c: New file.
  • Property mode set to 100644
File size: 862 bytes
Line 
1/*
2 *  RTEMS Malloc Get Free Information
3 *
4 *
5 *  COPYRIGHT (c) 1989-2007.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#if HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
20#include <rtems.h>
21#include <rtems/libcsupport.h>
22#include <rtems/score/protectedheap.h>
23
24#include <stdio.h>
25#include <stdlib.h>
26#include <sys/types.h>
27#include <assert.h>
28#include <errno.h>
29#include <string.h>
30
31extern Heap_Control  RTEMS_Malloc_Heap;
32
33/*
34 *  Find amount of free heap remaining
35 */
36
37size_t malloc_free_space( void )
38{
39  Heap_Information info;
40
41  _Protected_heap_Get_free_information( &RTEMS_Malloc_Heap, &info );
42  return (size_t) info.largest;
43}
Note: See TracBrowser for help on using the repository browser.