Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JLANG::JMalloc< JClass_t > Class Template Reference

Memory management class for create/release policy based on malloc()/free(). More...

#include <JMemory.hh>

Static Public Member Functions

static JClass_t * create ()
 Create object in memory.
 
static JClass_t * create (const unsigned int size)
 Create array of objects in memory.
 
static void release (JClass_t *p)
 Release memory.
 

Detailed Description

template<class JClass_t>
class JLANG::JMalloc< JClass_t >

Memory management class for create/release policy based on malloc()/free().

Definition at line 82 of file JMemory.hh.

Member Function Documentation

◆ create() [1/2]

template<class JClass_t >
static JClass_t * JLANG::JMalloc< JClass_t >::create ( )
inlinestatic

Create object in memory.

Returns
pointer to data

Definition at line 89 of file JMemory.hh.

90 {
91 return (JClass_t*) malloc(sizeof(JClass_t));
92 }

◆ create() [2/2]

template<class JClass_t >
static JClass_t * JLANG::JMalloc< JClass_t >::create ( const unsigned int size)
inlinestatic

Create array of objects in memory.

Parameters
sizenumber of elements
Returns
pointer to data

Definition at line 101 of file JMemory.hh.

102 {
103 return (JClass_t*) malloc(size * sizeof(JClass_t));
104 }

◆ release()

template<class JClass_t >
static void JLANG::JMalloc< JClass_t >::release ( JClass_t * p)
inlinestatic

Release memory.

Parameters
ppointer to data

Definition at line 112 of file JMemory.hh.

113 {
114 free((void*) p);
115 }

The documentation for this class was generated from the following file: