// Copyright 2021 The Libc Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.// +build !libc.membrk,!libc.memgrindpackage libc // import "modernc.org/libc"import ()constmemgrind = falsevar (allocatormemory.Allocator)// void *malloc(size_t size);func ( *TLS, types.Size_t) uintptr {if == 0 {return0 }allocMu.Lock()deferallocMu.Unlock() , := allocator.UintptrMalloc(int())if != nil { .setErrno(errno.ENOMEM)return0 }return}// void *calloc(size_t nmemb, size_t size);func ( *TLS, , types.Size_t) uintptr { := int( * )if == 0 {return0 }allocMu.Lock()deferallocMu.Unlock() , := allocator.UintptrCalloc(int( * ))if != nil { .setErrno(errno.ENOMEM)return0 }return}// void *realloc(void *ptr, size_t size);func ( *TLS, uintptr, types.Size_t) uintptr {allocMu.Lock()deferallocMu.Unlock() , := allocator.UintptrRealloc(, int())if != nil { .setErrno(errno.ENOMEM)return0 }return}// void free(void *ptr);func ( *TLS, uintptr) {if == 0 {return }allocMu.Lock()deferallocMu.Unlock()allocator.UintptrFree()}func ( uintptr) types.Size_t {allocMu.Lock()deferallocMu.Unlock()returntypes.Size_t(memory.UintptrUsableSize())}// MemAuditStart locks the memory allocator, initializes and enables memory// auditing. Finaly it unlocks the memory allocator.//// Some memory handling errors, like double free or freeing of unallocated// memory, will panic when memory auditing is enabled.//// This memory auditing functionality has to be enabled using the libc.memgrind// build tag.//// It is intended only for debug/test builds. It slows down memory allocation// routines and it has additional memory costs.func () {}// MemAuditReport locks the memory allocator, reports memory leaks, if any.// Finally it disables memory auditing and unlocks the memory allocator.//// This memory auditing functionality has to be enabled using the libc.memgrind// build tag.//// It is intended only for debug/test builds. It slows down memory allocation// routines and it has additional memory costs.func () error { returnnil }
The pages are generated with Goldsv0.3.6. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.