Leak FunctionTemplateHandle
They are cached through the app's lifetime, and freeing them at the right time is complicate, so just leak them.
This commit is contained in:
parent
d8d963b780
commit
2294a5ce69
1 changed files with 13 additions and 2 deletions
|
@ -13,10 +13,21 @@
|
|||
|
||||
namespace {
|
||||
|
||||
using FunctionTemplateHandle =
|
||||
v8::CopyablePersistentTraits<v8::FunctionTemplate>::CopyablePersistent;
|
||||
// A Persistent that can be copied and will not free itself.
|
||||
template<class T>
|
||||
struct LeakedPersistentTraits {
|
||||
typedef v8::Persistent<T, LeakedPersistentTraits<T> > LeakedPersistent;
|
||||
static const bool kResetInDestructor = false;
|
||||
template<class S, class M>
|
||||
static V8_INLINE void Copy(const v8::Persistent<S, M>& source,
|
||||
LeakedPersistent* dest) {
|
||||
// do nothing, just allow copy
|
||||
}
|
||||
};
|
||||
|
||||
// The handles are leaked on purpose.
|
||||
using FunctionTemplateHandle =
|
||||
LeakedPersistentTraits<v8::FunctionTemplate>::LeakedPersistent;
|
||||
std::map<std::string, FunctionTemplateHandle> function_templates_;
|
||||
|
||||
v8::Local<v8::Object> CreateObjectWithName(v8::Isolate* isolate,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue