Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mlabs-haskell/cardano-serialization-lib-gc

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mlabs-haskell/cardano-serialization-lib-gc

This is a small wrapper for managing garbage collection for @emurgo/cardano-serialization-library

  • 13.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

cardano-serialization-lib-gc

This is a small ESM library that provides a wrapper for managing garbage collection for cardano-serialization-library. It does this by using a FinalizationRegistry object to keep track of objects that are no longer in use, and calling the free() method on them when they are finalized.

Example usage with NodeJS:

import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc";

function fixture() {
  lib.PlutusData.new_bytes(
    new Uint8Array(Array(10000000).fill(0))
  );
}

setInterval(() => {
  for (let i = 0; i < 10; i++) {
    fixture()
  }
}, 500) // collection of unused objects will trigger `free()` calls
// for the corresponding WASM-allocated memory

This code will not leak, but if you try to use the original package, the memory usage will steadily grow.

If you want to use this library as a CommonJS module, use legacy csl-gc-wrapper instead.

FAQs

Package last updated on 18 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc