提交 140e2abc 编写于 作者: H Hongze Cheng

refact

上级 a9fccb1b
......@@ -65,6 +65,12 @@ struct SVnodeOptions {
*/
bool isWeak;
/**
* @brief if the allocator is heap allcator or arena allocator
*
*/
bool isHeapAllocator;
/**
* @brief TSDB options
*
......
......@@ -12,3 +12,56 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "vnodeDef.h"
/* ------------------------ Heap Allocator ------------------------ */
typedef struct {
uint64_t tsize;
uint64_t used;
} SVHeapAllocator;
SMemAllocator *vhaCreate(uint64_t size) {
SMemAllocator *pma;
pma = (SMemAllocator *)calloc(1, sizeof(*pma) + sizeof(SVHeapAllocator));
if (pma == NULL) {
return NULL;
}
pma->impl = POINTER_SHIFT(pma, sizeof(*pma));
/* TODO */
return NULL;
}
void vhaDestroy(SMemAllocator *pma) { /* TODO */
}
static void *vhaMalloc(SMemAllocator *pma, uint64_t size) {
SVHeapAllocator *pvha = (SVHeapAllocator *)(pma->impl);
/* TODO */
return NULL;
}
static void *vhaCalloc(SMemAllocator *pma, size_t nmemb, uint64_t size) {
// todo
return NULL;
}
static void *vhaRealloc(SMemAllocator *pma, void *ptr, uint64_t size) {
/* TODO */
return NULL;
}
static void vhaFree(SMemAllocator *pma, void *ptr) { /* TODO */
}
static uint64_t vhaUsage(SMemAllocator *pma) {
/* TODO */
return 0;
}
/* ------------------------ Arena Allocator ------------------------ */
typedef struct {
} SVArenaAllocator;
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册