1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: change the -d debug_malloc byte pattern to M so it is easier to spot with a plain text terminal.

This commit is contained in:
Delyan Angelov 2021-11-28 19:23:11 +02:00
parent 9c88317ca6
commit b4c52b72cf
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -289,9 +289,9 @@ pub fn malloc(n int) &byte {
panic('malloc($n) failed')
}
$if debug_malloc ? {
// Fill in the memory with something != 0, so it is easier to spot
// Fill in the memory with something != 0 i.e. `M`, so it is easier to spot
// when the calling code wrongly relies on it being zeroed.
unsafe { C.memset(res, 0x88, n) }
unsafe { C.memset(res, 0x4D, n) }
}
return res
}
@ -342,9 +342,9 @@ pub fn malloc_noscan(n int) &byte {
panic('malloc_noscan($n) failed')
}
$if debug_malloc ? {
// Fill in the memory with something != 0, so it is easier to spot
// Fill in the memory with something != 0 i.e. `M`, so it is easier to spot
// when the calling code wrongly relies on it being zeroed.
unsafe { C.memset(res, 0x88, n) }
unsafe { C.memset(res, 0x4D, n) }
}
return res
}