#include "malloc.h"
#include "types.h"
#include "algo.h"
#include "math.h"
#include <stdint.h>
#include <libiberty/splay-tree.h>
#include "object_maintainance.h"
#include <uv.h>
Go to the source code of this file.
◆ MEMOID_FIRST
◆ MEMOID_LAST
◆ __memalloc()
| MEMoid __memalloc |
( |
size_t |
size, |
|
|
int |
which_ram |
|
) |
| |
Allocates the memory requested and returns a MEMoid.
- Parameters
-
| size | the size of the object that needs to be allocated. |
| which_ram | the RAM in which the allocation must happen. |
- Returns
- The
MEMoid object after allocation is completed.
- Note
- This is an internal function. It is not exposed to other files.
- See also
- _memalloc() memalloc()
Definition at line 138 of file malloc.c.
◆ _key_get_first()
◆ _key_get_last()
◆ _memalloc()
| MEMoidKey _memalloc |
( |
size_t |
size, |
|
|
const char * |
file, |
|
|
const char * |
func, |
|
|
const int |
line, |
|
|
int |
num_args, |
|
|
|
... |
|
) |
| |
Allocates the memory requested and returns a MEMoidKey.
- Parameters
-
| size | the size of the object that needs to be allocated. |
| file | the file where the requested object is defined. |
| func | the function where the requested object is defined. |
| line | the line number where the requested object is defined. |
| which_ram | (optional): the RAM in which the allocation must happen. |
- Returns
- The
MEMoidkey object after allocation is completed.
- See also
- __memalloc() memalloc()
- Attention
- This function is responsible for checking if the requested object is present in NVRAM from the previous run (to ensure
crash consistency).
-
It has to add the created objects into
object_maintainance table, type_table and splay_tree.
Definition at line 202 of file malloc.c.
◆ _memfree()
The fucntion to free the allocated memory location.
- Parameters
-
| oidkey | the MEMoidKey of the object whose memory needs to be freed. |
- Returns
- Nothing.
- Note
- This function doesn't call nvm_free() or
free() by itself, instead it enques the deletion task for the deletion thread to take care of it.
Definition at line 358 of file malloc.c.
◆ addr2memoid_cmp()
| int addr2memoid_cmp |
( |
splay_tree_key |
key1, |
|
|
splay_tree_key |
key2 |
|
) |
| |
The compare function used by the splay_tree.
- Parameters
-
| key1 | the splay_tree_key of one of the elements that needs to be compared. |
| key2 | the splay_tree_key of the other element that needs to be compared. |
- Returns
- 0: if both are equivalent.
-
the direction in which the search should continue, if the two elements are not equivalent.
Definition at line 409 of file malloc.c.
◆ addr2memoid_del()
| void addr2memoid_del |
( |
splay_tree_key |
key | ) |
|
◆ allot_first_free_offset()
| MEMoid allot_first_free_offset |
( |
size_t |
size | ) |
|
Allocates the first free memory chunk of the given size.
- Parameters
-
| size | the size of memory that needs to be allocated. |
- Returns
MEMoid object.
- Attention
- This function is responsible to create a new
pool iff any of the previous pools are insufficient for the asked size.
- See also
- allot_first_free_offset_pool()
Definition at line 104 of file malloc.c.
◆ allot_first_free_offset_pool()
Allocates first free memory chunk of the given size in the given pool specified by pool_id.
- Parameters
-
| pool_id | the ID of the pool where the allocation needs to be made. |
| size | the size of memory that needs to be allocated. |
- Returns
- The
offset of the memory chuck allocated. This offset is from the first address of the pool.
- Note
- This is an internal function. It is not exposed to other files.
- See also
- allot_first_free_offset()
Definition at line 48 of file malloc.c.
◆ free_slot_size()
◆ get_memobj_direct()
| void* get_memobj_direct |
( |
MEMoid |
oid | ) |
|
The function to return the actual memptr for a given MEMoid object.
- Parameters
-
- Returns
- The memory address represented by
oid.
Definition at line 316 of file malloc.c.
◆ init_splay()
◆ string_hash()
| uint64_t string_hash |
( |
const char * |
str | ) |
|
◆ addr2MemOID_read
| splay_tree addr2MemOID_read |
◆ addr2MemOID_write
| splay_tree addr2MemOID_write |