|
CXXR (C++ R)
|
#include "CXXR/RAllocStack.h"#include <cstring>#include <stdexcept>#include "R_ext/Error.h"#include "localization.h"#include "CXXR/MemoryBank.hpp"
Namespaces | |
| namespace | CXXR |
| Namespace for the CXXR project. | |
Functions | |
| char * | R_alloc (size_t num_elts, int elt_size) |
| Allocate a block of memory. | |
| char * | S_alloc (long num_elts, int elt_size) |
| Allocate a block of memory, and initialize it to zero. | |
| char * | S_realloc (char *prev_block, long new_sz, long old_sz, int elt_size) |
| Reallocate a block of memory. | |
Variables | |
| void *(* | CXXR::ForceNonInline::vmaxgetp )(void) = vmaxget |
| void(* | CXXR::ForceNonInline::vmaxsetp )(const void *) = vmaxset |
Implementation of class RAllocStack and related functions.
| char* R_alloc | ( | size_t | num_elts, |
| int | elt_size | ||
| ) |
Allocate a block of memory.
This function is provided primarily for the use of code called from the R .C function. It will allocate a block of memory that will automatically be reclaimed by R at the end of the .C call.
| num_elts | Number of data items to be accommodated in the block. |
| elt_size | Size in bytes (strictly, as a multiple of sizeof(char)) of each data item. Must be non-negative. |
| char* S_alloc | ( | long | num_elts, |
| int | elt_size | ||
| ) |
Allocate a block of memory, and initialize it to zero.
This is part of the S compatibility interface. It does the same thing as R_alloc(), except that the memory block is guaranteed to be initialized to zero.
| num_elts | Number of data items to be accommodated in the block. Must be non-negative. |
| elt_size | Size in bytes (strictly, as a multiple of sizeof(char)) of each data item. Must be non-negative. |
| char* S_realloc | ( | char * | prev_block, |
| long | new_sz, | ||
| long | old_sz, | ||
| int | elt_size | ||
| ) |
Reallocate a block of memory.
This is part of the S compatibility interface, and is used when it is decided that a block of memory previously allocated by S_alloc() or S_realloc() needs to be expanded. It allocates a new block of memory, copies across the previous contents, and zeroes any additional elements.
| prev_block | Pointer to a block of memory previously allocated by S_alloc() or S_realloc(). |
| new_sz | New number of elements (>= 0) to be accommodated. |
| old_sz | Number of elements contained in prev_block. |
| elt_size | Size in bytes (strictly, as a multiple of sizeof(char)) of each data item. Must be non-negative. |
<= old_sz, the function does not allocate a new block, and simply returns prev_block.
1.8.1