Lolly 1.4.28
Loading...
Searching...
No Matches
Functions
je_malloc.cpp File Reference
#include "assert.h"
#include "fast_alloc.hpp"
#include "tm_ostream.hpp"
#include <jemalloc/jemalloc.h>
Include dependency graph for je_malloc.cpp:

Go to the source code of this file.

Functions

int mem_used ()
 
voidsafe_malloc (size_t sz)
 
voidfast_alloc (size_t sz)
 
void fast_free (void *ptr, size_t sz)
 
voidfast_realloc (void *ptr, size_t, size_t new_size)
 
voidfast_new (size_t s)
 
void fast_delete (void *ptr)
 
void mem_init ()
 
void mem_info ()
 

Function Documentation

◆ mem_used()

int mem_used ( )

Definition at line 73 of file je_malloc.cpp.

73 {
74 cerr << "memory statistics is NOT IMPLEMENTED\n";
75 return 0;
76}
tm_ostream & cerr

◆ safe_malloc()

void * safe_malloc ( size_t sz)

Definition at line 24 of file je_malloc.cpp.

24 {
25 void* ptr= malloc (sz);
26
27 if (ptr == NULL) {
28 cerr << "Fatal error: out of memory\n";
29 abort ();
30 }
31 return ptr;
32}
The list class represents a linked list.
Definition list.hpp:48

◆ fast_alloc()

void * fast_alloc ( size_t sz)

Definition at line 35 of file je_malloc.cpp.

35 {
36 return safe_malloc (sz);
37}
void * safe_malloc(size_t sz)
Definition je_malloc.cpp:24

◆ fast_free()

void fast_free ( void * ptr,
size_t sz )

Definition at line 40 of file je_malloc.cpp.

40 {
41 free (ptr);
42}

◆ fast_realloc()

void * fast_realloc ( void * ptr,
size_t old_size,
size_t new_size )

Definition at line 45 of file je_malloc.cpp.

45 {
46 void* new_ptr= realloc (ptr, new_size);
47
48 if (new_ptr == NULL) {
49 cerr << "Fatal error: out of memory\n";
50 abort ();
51 }
52 return new_ptr;
53}

◆ fast_new()

void * fast_new ( size_t s)

Definition at line 56 of file je_malloc.cpp.

56 {
57 return safe_malloc (s);
58}

◆ fast_delete()

void fast_delete ( void * ptr)

Definition at line 61 of file je_malloc.cpp.

61 {
62 free (ptr);
63}

◆ mem_init()

void mem_init ( )

Definition at line 66 of file je_malloc.cpp.

66{}

◆ mem_info()

void mem_info ( )

Definition at line 79 of file je_malloc.cpp.

79 {
80 cout << "\n------- (NOT IMPLEMENTED) memory statistics -------\n";
81}
tm_ostream & cout