Closed bjornkihlberg closed 10 months ago
foreign-alloc
and foreign-free
call foreign procedures s_malloc
and s_free
, which in turn call malloc
and free
from the C library. Whether the C++ functions std::malloc
and std::free
use the same C library functions is a different question, but I assume all major implementations do even if it's not technically required by the C++ standard.
Of course, this is not a documented behavior of Chez Scheme, so theoretically it could change in the future... but I would find that very surprising.
Thank you for the answer! This helps me understand what is going on under the hood.
Can
foreign-free
in Chez Scheme free memory allocated in C++ withmalloc
and canfree
in C++ free memory allocated withforeign-alloc
in Chez Scheme or are the different systems maintaining their own list of allocated memory such that responsibility of the memory can't be transferred between them?// Regards Björn Kihlberg