WISH: Lower memory use by not counting with byte terminator in the Make_Binary
function.
#2480
Labels
enhancement
New feature or request
Make_Binary
function.
#2480
Currently when
Make_Binary
C function is called, it requires 1 more byte.But as the memory is allocated from pools, it actually uses double memory (usually), just because of this reserved space for the terminator byte. It can be demonstrated in the debug builds using the
dump
function. For example:Notice the
size: 64
andsize: 2048
. The reason is, that we actually need to allocate33
and1025
bytes now, and the nearest memory pool sizes for such values are these64
and2048
. Old rebolers knew that and have been using size 1 less, but that is ugly and strange.I suppose that the terminator byte is a leftover from Rebol2, where it was possible to coerce binary to string without encoding using
as-string
. This is not allowed anymore and so the terminator should not be required when making a binary with an exact size.The text was updated successfully, but these errors were encountered: