This is the first of probably several implementations of heap management for this JVM implementation. It uses the simple OS/stdlib resources of malloc(3)/free(3
) as the foundation for its management scheme. The memory allocation pointer is generated by malloc(3).
Calling free(3) with
this same pointer marks the block of memory as available for other allocation.
The common header file gc.h defines the prototypes for all heap allocation implementations by way of the CONFIG_HEAP_TYPE_xxx symbol definitions.
Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
Definition in file heap_simple.c.
#include "arch.h"
#include <errno.h>
#include <stdlib.h>
#include "jvmcfg.h"
#include "exit.h"
#include "gc.h"
#include "heap.h"
#include "jvmclass.h"
#include "util.h"
Go to the source code of this file.
Functions | |
static rvoid | heap_free_common_simple (rvoid *pheap_block) |
Release a previously allocated block back into the heap for future reallocation. | |
rvoid | heap_free_data_simple (rvoid *pheap_block) |
Release a previously allocated data block back into the heap for future reallocation. | |
rvoid | heap_free_method_simple (rvoid *pheap_block) |
Release a previously allocated method block back into the heap for future reallocation. | |
rvoid | heap_free_stack_simple (rvoid *pheap_block) |
Release a previously allocated stack block back into the heap for future reallocation. | |
static rvoid * | heap_get_common_simple (int size, rboolean clrmem_flag) |
Simple heap allocation method that uses only malloc(3) and free(3). | |
rvoid * | heap_get_data_simple (int size, rboolean clrmem_flag) |
Allocate memory for a data area from heap to caller. | |
int | heap_get_error_simple (rvoid *badptr) |
Allocation failure diagnostic. | |
rvoid * | heap_get_method_simple (int size, rboolean clrmem_flag) |
Allocate memory for a method from heap to caller. | |
rvoid * | heap_get_stack_simple (int size, rboolean clrmem_flag) |
Allocate memory for a stack area from heap to caller. | |
rvoid | heap_init_simple () |
Start up heap management methodology. | |
rvoid | heap_shutdown_simple () |
Shut down up heap management after JVM execution is finished. | |
static void | heap_simple_c_dummy (void) |
Variables | |
static rlong | heap_free_count = 0 |
Number of calls to free(3). | |
static int | heap_last_errno = 0 |
Most recent error code from malloc(3), for use by heap_get_error_simple(). Typically found in <errno.h> or <sys/errno.h>. | |
static rlong | heap_malloc_count = 0 |
Number of calls to malloc(3). | |
static char * | heap_simple_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/heap_simple.c $ $Id: heap_simple.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable." |
|
Definition at line 53 of file heap_simple.c. |
|
Start up heap management methodology. In a malloc/free scheme, there is nothing to do, but in other methods there might be. Parameters: rvoid
Definition at line 81 of file heap_simple.c. References jvm_heap_initialized, and rtrue. |
|
Simple heap allocation method that uses only
Definition at line 155 of file heap_simple.c. |
|
Allocate memory for a method from heap to caller. When finished, this pointer should be sent back to heap_free_method_simple() for reallocation.
Definition at line 272 of file heap_simple.c. |
|
Allocate memory for a stack area from heap to caller. When finished, this pointer should be sent back to heap_free_stack_simple() for reallocation.
Definition at line 314 of file heap_simple.c. |
|
Allocate memory for a data area from heap to caller. When finished, this pointer should be sent back to heap_free_data_simple() for reallocation.
Definition at line 356 of file heap_simple.c. |
|
Release a previously allocated block back into the heap for future reallocation. If a rnull pointer is passed in, ignore the request.
Definition at line 383 of file heap_simple.c. References heap_free_count. |
|
Release a previously allocated method block back into the heap for future reallocation.
Definition at line 418 of file heap_simple.c. |
|
Release a previously allocated stack block back into the heap for future reallocation.
Definition at line 439 of file heap_simple.c. |
|
Release a previously allocated data block back into the heap for future reallocation.
Definition at line 460 of file heap_simple.c. |
|
Allocation failure diagnostic. Returns an errno value per "errno.h" if a rnull pointer is passed in, namely from the most recent call to a heap allocation function. It may only be called once before the value is cleared. If a non-null pointer is passed in, ERROR0 is returned and the error status is again cleared.
< Typically found in <errno.h> or <sys/errno.h> < Typically found in <errno.h> or <sys/errno.h> Definition at line 488 of file heap_simple.c. References ERROR0, and heap_last_errno. |
|
Shut down up heap management after JVM execution is finished. Parameters: rvoid
Definition at line 524 of file heap_simple.c. |
|
Definition at line 53 of file heap_simple.c. |
|
Most recent error code from
Definition at line 97 of file heap_simple.c. |
|
Number of calls to One of two global variables providing rudimentary statistics for heap allocation history.
Definition at line 110 of file heap_simple.c. |
|
Number of calls to One of two global variables providing rudimentary statistics for heap allocation history.
Definition at line 120 of file heap_simple.c. |