OpenMPI
0.1.1
|
Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana University Research and Technology Corporation. More...
#include "ompi_config.h"
#include <stdlib.h>
#include <string.h>
#include "opal/threads/mutex.h"
#include "ompi/class/ompi_free_list.h"
#include "ompi/mca/allocator/allocator.h"
Go to the source code of this file.
Data Structures | |
struct | mca_allocator_basic_segment_t |
struct | mca_allocator_basic_module_t |
Typedefs | |
typedef struct mca_allocator_basic_segment_t | mca_allocator_basic_segment_t |
typedef struct mca_allocator_basic_module_t | mca_allocator_basic_module_t |
Functions | |
BEGIN_C_DECLS int | mca_allocator_basic_component_open (void) |
int | mca_allocator_basic_component_close (void) |
mca_allocator_base_module_t * | mca_allocator_basic_component_init (bool enable_mpi_threads, mca_allocator_base_component_segment_alloc_fn_t segment_alloc, mca_allocator_base_component_segment_free_fn_t segment_free, struct mca_mpool_base_module_t *module) |
The function used to initialize the component. | |
void * | mca_allocator_basic_alloc (mca_allocator_base_module_t *mem, size_t size, size_t align, mca_mpool_base_registration_t **registration) |
Accepts a request for memory in a specific region defined by the mca_allocator_basic_options_t struct and returns a pointer to memory in that region or NULL if there was an error. More... | |
void * | mca_allocator_basic_realloc (mca_allocator_base_module_t *mem, void *ptr, size_t size, mca_mpool_base_registration_t **registration) |
Attempts to resize the passed region of memory into a larger or a smaller region. More... | |
void | mca_allocator_basic_free (mca_allocator_base_module_t *mem, void *ptr) |
Frees the passed region of memory. More... | |
int | mca_allocator_basic_compact (mca_allocator_base_module_t *mem) |
Frees all the memory from all the basics back to the system. More... | |
int | mca_allocator_basic_finalize (mca_allocator_base_module_t *mem) |
Cleanup all resources held by this allocator. More... | |
Variables | |
OMPI_DECLSPEC mca_allocator_base_component_t | mca_allocator_basic_component |
Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana University Research and Technology Corporation.
All rights reserved. Copyright (c) 2004-2005 The University of Tennessee and The University of Tennessee Research Foundation. All rights reserved. Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, University of Stuttgart. All rights reserved. Copyright (c) 2004-2005 The Regents of the University of California. All rights reserved. $COPYRIGHT$
Additional copyrights may follow
$HEADER$ A generic memory basic allocator.
void* mca_allocator_basic_alloc | ( | mca_allocator_base_module_t * | base, |
size_t | size, | ||
size_t | align, | ||
mca_mpool_base_registration_t ** | registration | ||
) |
Accepts a request for memory in a specific region defined by the mca_allocator_basic_options_t struct and returns a pointer to memory in that region or NULL if there was an error.
mem | A pointer to the appropriate struct for the area of memory. |
size | The size of the requested area of memory |
Pointer | to the area of memory if the allocation was successful |
NULL | if the allocation was unsuccessful |
References opal_list_append, opal_list_get_end(), opal_list_get_first(), opal_list_get_next, opal_list_remove_item(), OPAL_THREAD_LOCK, and OPAL_THREAD_UNLOCK.
Referenced by mca_allocator_basic_component_init(), and mca_allocator_basic_realloc().
int mca_allocator_basic_compact | ( | mca_allocator_base_module_t * | mem | ) |
Frees all the memory from all the basics back to the system.
Note that this function only frees memory that was previously freed with mca_allocator_basic_free().
mem | A pointer to the appropriate struct for the area of memory. |
None |
Referenced by mca_allocator_basic_component_init().
int mca_allocator_basic_finalize | ( | mca_allocator_base_module_t * | base | ) |
Cleanup all resources held by this allocator.
mem | A pointer to the appropriate struct for the area of memory. |
None |
References OBJ_DESTRUCT.
Referenced by mca_allocator_basic_component_init().
void mca_allocator_basic_free | ( | mca_allocator_base_module_t * | base, |
void * | ptr | ||
) |
Frees the passed region of memory.
mem | A pointer to the appropriate struct for the area of memory. |
ptr | A pointer to the region of memory to be freed |
None |
References opal_list_append, opal_list_get_end(), opal_list_get_first(), opal_list_get_next, opal_list_insert_pos(), OPAL_THREAD_LOCK, and OPAL_THREAD_UNLOCK.
Referenced by mca_allocator_basic_component_init(), and mca_allocator_basic_realloc().
void* mca_allocator_basic_realloc | ( | mca_allocator_base_module_t * | base, |
void * | ptr, | ||
size_t | size, | ||
mca_mpool_base_registration_t ** | registration | ||
) |
Attempts to resize the passed region of memory into a larger or a smaller region.
If it is unsuccessful, it will return NULL and the passed area of memory will be untouched.
mem | A pointer to the appropriate struct for the area of memory. |
size | The size of the requested area of memory |
ptr | A pointer to the region of memory to be resized |
Pointer | to the area of memory if the reallocation was successful |
NULL | if the allocation was unsuccessful |
References mca_allocator_basic_alloc(), and mca_allocator_basic_free().
Referenced by mca_allocator_basic_component_init().