Commit 6ba38e8c authored by Gabriel Schulhof's avatar Gabriel Schulhof Committed by Myles Borins
Browse files

N-API: Reuse ObjectTemplate instances

V8 caches and does not subsequently release `ObjectTemplate` instances.
Thus, we need to store the `ObjectTemplate` from which we derive object
instances we use for `napi_wrap()` and function/accessor context in a
persistent in the `napi_env`.

https://github.com/nodejs/node-addon-api/pull/70#discussion_r124998408

Backport-PR-URL: https://github.com/nodejs/node/pull/19447
PR-URL: https://github.com/nodejs/node/pull/13999


Reviewed-By: default avatarBen Noordhuis <info@bnoordhuis.nl>
Reviewed-By: default avatarAnna Henningsen <anna@addaleax.net>
Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarMichael Dawson <michael_dawson@ca.ibm.co>
Reviewed-By: default avatarHitesh Kanwathirtha <digitalinfinity@gmail.com>
parent 7f126c20
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment