mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
builtin: support -d builtin_free_nop
to help diagnose problems with too early manual free() calls
This commit is contained in:
parent
194db24829
commit
dc1d091ac1
1 changed files with 3 additions and 0 deletions
|
@ -680,6 +680,9 @@ pub fn free(ptr voidptr) {
|
|||
$if trace_free ? {
|
||||
C.fprintf(C.stderr, c'free ptr: %p\n', ptr)
|
||||
}
|
||||
$if builtin_free_nop ? {
|
||||
return
|
||||
}
|
||||
if ptr == unsafe { 0 } {
|
||||
$if trace_free_nulls ? {
|
||||
C.fprintf(C.stderr, c'free null ptr\n', ptr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue