In Wasm Specification, data segments and memory are seperated. However, in Binaryen's current C API, they are deeply coupled.
This leads to some awkward use case, suppose there is a wasm module containing only data segments, and I want to add memory into it, I have to manually copy all existing data segments and pass them into BinaryenSetMemory, which is unnecessary if we can preserve original data segments.
Therefore, I wonder if we could add an additional argument to BinaryenSetMemory that indicates whether we should preserve the data segments or not. If that's reasonable, I already created a pull request #6313 and maybe you can check that out ;).