mratsim / constantine

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

Custom Vec/Seq with destructors #421

Open mratsim opened 2 weeks ago

mratsim commented 2 weeks 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 2 weeks ago

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