Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

add capacity to svm_byte_array #185

Merged
merged 5 commits into from
Nov 10, 2020
Merged

add capacity to svm_byte_array #185

merged 5 commits into from
Nov 10, 2020

Conversation

moshababo
Copy link
Contributor

Added capacity to svm_byte_array (the total number of allocated bytes).
It may be unequal and bigger than length if the svm_byte_array instance is an alias to an instance of a data structure such as Vec (which in order to properly get deallocated needs first to be re-constructed using the proper allocated capacity).

Vec#leak wasn't used because in order to remove the surplus capacity it clones the data, while svm_byte_array is intended to be an alias.

Closing #129.

crates/svm-runtime-c-api/src/byte_array.rs Show resolved Hide resolved
crates/svm-runtime-c-api/src/byte_array.rs Outdated Show resolved Hide resolved
crates/svm-runtime-c-api/src/byte_array.rs Outdated Show resolved Hide resolved
crates/svm-runtime-c-api/src/macros.rs Show resolved Hide resolved
crates/svm-runtime-c-api/src/value.rs Outdated Show resolved Hide resolved
crates/svm-runtime-c-api/src/value.rs Outdated Show resolved Hide resolved
@moshababo moshababo force-pushed the byte_arr_cap branch 2 times, most recently from 5b446dd to dd61def Compare November 9, 2020 17:22
@YaronWittenstein YaronWittenstein merged commit 88d18c7 into master Nov 10, 2020
@YaronWittenstein YaronWittenstein deleted the byte_arr_cap branch November 10, 2020 09:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants