SpiNNFrontEndCommon 7.2.2
Common support code for user-facing front end systems.
Loading...
Searching...
No Matches
Macros | Enumerations | Functions
malloc_extras.h File Reference

Support for adding debugging information to dynamic allocation. More...

#include <sark.h>
#include <common-typedefs.h>
#include <debug.h>

Go to the source code of this file.

Macros

#define MALLOC   malloc_extras_malloc
 An easily-insertable name for the memory allocator.
 
#define FREE   malloc_extras_free
 An easily-insertable name for the memory free.
 
#define FREE_MARKED   malloc_extras_free_marked
 An easily-insertable name for the alternate memory free.
 
#define MALLOC_SDRAM   malloc_extras_sdram_malloc_wrapper
 An easily-insertable name for the memory allocator that uses the large pool.
 

Enumerations

enum  exit_states_for_user_one {
  EXITED_CLEANLY = 0 , EXIT_FAIL = 1 , EXIT_MALLOC = 2 , EXIT_SWERR = 3 ,
  DETECTED_MALLOC_FAILURE = 4
}
 The different states to report through vcpu->user1 More...
 

Functions

void malloc_extras_turn_on_print (void)
 Turn on printing.
 
void malloc_extras_turn_off_print (void)
 Turn off printing.
 
void malloc_extras_terminate (uint result_code)
 Stops execution with a result code.
 
void malloc_extras_free (void *ptr)
 Frees a pointer without any marker for application code.
 
voidmalloc_extras_sdram_malloc (uint bytes)
 Mallocs a number of bytes from SDRAM.
 
voidmalloc_extras_malloc (uint bytes)
 Allows a search of the 2 heaps available. (DTCM, stolen SDRAM)
 
uint malloc_extras_max_available_block_size (void)
 Locates the biggest block of available memory from the heaps.
 

Detailed Description

Support for adding debugging information to dynamic allocation.

Definition in file malloc_extras.h.

Macro Definition Documentation

◆ MALLOC

An easily-insertable name for the memory allocator.

Definition at line 77 of file malloc_extras.h.

◆ FREE

An easily-insertable name for the memory free.

Definition at line 79 of file malloc_extras.h.

◆ FREE_MARKED

#define FREE_MARKED   malloc_extras_free_marked

An easily-insertable name for the alternate memory free.

Definition at line 81 of file malloc_extras.h.

◆ MALLOC_SDRAM

An easily-insertable name for the memory allocator that uses the large pool.

Definition at line 83 of file malloc_extras.h.

Enumeration Type Documentation

◆ exit_states_for_user_one

The different states to report through vcpu->user1

Enumerator
EXITED_CLEANLY 

Everything is fine.

EXIT_FAIL 

We went wrong but we dont want to RTE.

EXIT_MALLOC 

We ran out of space and we want to RTE.

EXIT_SWERR 

We hit an internal error and we want to RTE.

DETECTED_MALLOC_FAILURE 

We detected a problem and want to RTE.

Definition at line 27 of file malloc_extras.h.

Function Documentation

◆ malloc_extras_turn_on_print()

void malloc_extras_turn_on_print ( void  )

Turn on printing.

Note
Printing of allocations can take a lot of IOBUF space.

Definition at line 46 of file malloc_extras.c.

◆ malloc_extras_turn_off_print()

void malloc_extras_turn_off_print ( void  )

Turn off printing.

Definition at line 50 of file malloc_extras.c.

◆ malloc_extras_terminate()

void malloc_extras_terminate ( uint  result_code)

Stops execution with a result code.

Parameters
[in]result_codecode to put in user 1

Definition at line 57 of file malloc_extras.c.

◆ malloc_extras_free()

void malloc_extras_free ( void ptr)

Frees a pointer without any marker for application code.

Parameters
[in]ptrthe pointer to free.

Definition at line 68 of file malloc_extras.c.

◆ malloc_extras_sdram_malloc()

void * malloc_extras_sdram_malloc ( uint  bytes)

Mallocs a number of bytes from SDRAM.

If safety turned on, it allocates more SDRAM to support buffers and size recordings.

Parameters
[in]bytesthe number of bytes to allocate from SDRAM.
Returns
the pointer to the location in SDRAM to use in application code.

Definition at line 84 of file malloc_extras.c.

◆ malloc_extras_malloc()

void * malloc_extras_malloc ( uint  bytes)

Allows a search of the 2 heaps available. (DTCM, stolen SDRAM)

Note
Commented out as this can cause stack overflow issues quickly. If deemed safe, could be uncommented. That is the same to the #define below at the end of the file
Parameters
[in]bytesthe number of bytes to allocate.
Returns
: the address of the block of memory to utilise.

Definition at line 99 of file malloc_extras.c.

◆ malloc_extras_max_available_block_size()

uint malloc_extras_max_available_block_size ( void  )

Locates the biggest block of available memory from the heaps.

Returns
the biggest block size in the heaps.