Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dlmalloc: add missing docs #23866

Merged
merged 4 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions vlib/dlmalloc/dlmalloc.v
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ mut:
release_checks usize
}

// new creates a new instance of `Dlmalloc` with the given system allocator.
pub fn new(system_allocator Allocator) Dlmalloc {
return Dlmalloc{
smallmap: 0
Expand Down Expand Up @@ -914,6 +915,7 @@ fn (mut dl Dlmalloc) treemap_is_marked(idx u32) bool {
return dl.treemap & (1 << idx) != 0
}

// malloc allocates a block of memory of the given size.
pub fn (mut dl Dlmalloc) malloc(size usize) voidptr {
unsafe {
p := dl.malloc_real(size)
Expand Down
1 change: 1 addition & 0 deletions vlib/dlmalloc/dlmalloc_sys_nix.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ fn system_page_size(_ voidptr) usize {
return 4096
}

// get_system_allocator returns an allocator that uses the system allocator.
pub fn get_system_allocator() Allocator {
return Allocator{
alloc: system_alloc
Expand Down
1 change: 1 addition & 0 deletions vlib/dlmalloc/dlmalloc_sys_windows.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ fn system_page_size(_ voidptr) usize {
return 4096
}

// get_system_allocator returns an allocator that uses the system allocator.
pub fn get_system_allocator() Allocator {
return Allocator{
alloc: system_alloc
Expand Down
Loading