mratsim / constantine

Constantine: modular, high-performance, zero-dependency cryptography stack for verifiable computation, proof systems and blockchain protocols.
Other
413 stars 44 forks source link

Custom Vec/Seq with destructors #421

Open mratsim opened 4 months ago

mratsim commented 4 months ago

Constantine does not use seq to ensure it does not depend on Nim runtime and to allow end user to pick their allocator of choice, for example jemalloc for long-running application or mimalloc. This also helps using address sanitizer or Valgrind on the library.

However manual memory management is tedious and error prone so we likely need to add a custom vector type. Which shouldn't need redimensioning.

The name is up in the air as we might not want to conflate computer science vectors with mathematical vectors should we need some in the future.

mratsim commented 4 months ago

See https://nim-lang.org/docs/destructors.html for a tutorial