This commit is contained in:
Hongze Cheng 2021-11-09 17:52:06 +08:00
parent 140e2abc83
commit 5c5d6eb1fb
2 changed files with 39 additions and 4 deletions

View File

@ -18,6 +18,8 @@
#include "mallocator.h" #include "mallocator.h"
#include "sync.h" #include "sync.h"
#include "tlockfree.h"
#include "vnode.h" #include "vnode.h"
#include "vnodeAllocatorPool.h" #include "vnodeAllocatorPool.h"
#include "vnodeCommit.h" #include "vnodeCommit.h"

View File

@ -15,12 +15,47 @@
#include "vnodeDef.h" #include "vnodeDef.h"
/* ------------------------ Heap Allocator ------------------------ */
typedef struct { typedef struct {
uint64_t tsize; uint64_t tsize;
uint64_t used; uint64_t used;
} SVHeapAllocator; } SVHeapAllocator;
typedef struct SVArenaNode {
struct SVArenaNode *prev;
} SVArenaNode;
typedef struct {
} SVArenaAllocator;
typedef struct {
int8_t type;
uint64_t tsize;
T_REF_DECLARE()
union {
SVHeapAllocator vha;
SVArenaAllocator vaa;
};
} SVMemAllocator;
SMemAllocator *vnodeCreateMemAllocator(int8_t type, uint64_t size) {
/* TODO */
return NULL;
}
void vnodeDestroyMemAllocator(SMemAllocator *pma) {
// TODO
}
void vnodeRefMemAllocator(SMemAllocator *pma) {
// TODO
}
void vnodeUnrefMemAllocator(SMemAllocator *pma) {
// TODO
}
/* ------------------------ Heap Allocator IMPL ------------------------ */
SMemAllocator *vhaCreate(uint64_t size) { SMemAllocator *vhaCreate(uint64_t size) {
SMemAllocator *pma; SMemAllocator *pma;
@ -62,6 +97,4 @@ static uint64_t vhaUsage(SMemAllocator *pma) {
return 0; return 0;
} }
/* ------------------------ Arena Allocator ------------------------ */ /* ------------------------ Arena Allocator IMPL ------------------------ */
typedef struct {
} SVArenaAllocator;