Skip to content

内存分配错误 #267

@vkensou

Description

@vkensou

描述问题

调用tb_align_malloc(2104, 512); 会有断言错误:

期待的结果

正常分配内存

错误信息

[tbox]: [allocator]: [assert]: at tb_assert_impl(): 300, C:\Users\user\AppData\Local\.xmake\cache\packages\2410\t\tbox\v1.7.6\source\tbox\src\tbox\prefix\assert.h: expr[!((tb_size_t)data & (align - 1))] at tb_allocator_align_malloc_(): 373, src\tbox\memory\allocator.c

相关环境

windows msvc 但我感觉跟系统和编译器关系不大

xmake.lua

add_requires("tbox v1.7.6", {configs = {debug = is_mode("debug")}})

target("main")
    set_kind("binary")
    add_packages("tbox")
    add_files("main.cpp")

main.cpp

#include "tbox/tbox.h"

int main()
{
    tb_init(tb_null, tb_null);
    tb_align_malloc(2104, 512);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions