This is a port of the mruby/c tutorial Chapter 03 to the mbed environment.

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers alloc.h Source File

alloc.h

Go to the documentation of this file.
00001 /*! @file
00002   @brief
00003   mrubyc memory management.
00004 
00005   <pre>
00006   Copyright (C) 2015 Kyushu Institute of Technology.
00007   Copyright (C) 2015 Shimane IT Open-Innovation Center.
00008 
00009   This file is distributed under BSD 3-Clause License.
00010 
00011   Memory management for objects in mruby/c.
00012 
00013   </pre>
00014 */
00015 
00016 #ifndef MRBC_SRC_ALLOC_H_
00017 #define MRBC_SRC_ALLOC_H_
00018 
00019 #include <stdint.h>
00020 #include "vm.h"    // for mruby/c
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 void mrbc_init_alloc(void);
00027 uint8_t *mrbc_raw_alloc(uint32_t size);
00028 uint8_t *mrbc_raw_realloc(uint8_t *ptr, uint32_t size);
00029 void mrbc_raw_free(void *ptr);
00030 
00031 void mrbc_alloc_debug(void);
00032 
00033 // for mruby/c
00034 uint8_t *mrbc_alloc(mrb_vm *vm, int size);
00035 uint8_t *mrbc_realloc(mrb_vm *vm, void *ptr, int size);
00036 void mrbc_free(mrb_vm *vm, void *ptr);
00037 void mrbc_free_all(mrb_vm *vm);
00038 
00039 #ifdef __cplusplus
00040 }
00041 #endif
00042 #endif
00043