I trying to understand why I'm getting error when I insert some value in std::unordered_map of c++, my binder is like bellow:
#include <node.h>
#include <iostream>
#include <unordered_map>
namespace demo {
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::String;
using v8::Value;
using v8::Number;
using v8::Array;
using v8::Exception;
void Process(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
std::unordered_map<int,int> t;
std::cout << "Trying to insert in hash..." << std::endl;
t.insert(pair<int,int>(1,10));
std::cout << "Doesn't come here..." << std::endl;
args.GetReturnValue();
}
void init(Local<Object> exports) {
NODE_SET_METHOD(exports, "create", Create);
NODE_SET_METHOD(exports, "process", Process);
}
NODE_MODULE(addon, init)
}
I got error in insert method of std::unordered_map. The error bellow:
*** Error in `node': munmap_chunk(): invalid pointer: 0x00007ffd15e328b0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x77725)[0x7fbfae4e5725]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x1a8)[0x7fbfae4f1c18] node(_ZNSt10_HashtableIiSt4pairIKiiESaIS2_ENSt8__detail10_Select1stESt8equal_toIiESt4hashIiENS4_18_Mod_range_hashingENS4_20_Default_ranged_hashENS4_20_Prime_rehash_policyENS4_17_Hashtable_traitsILb0ELb0ELb1EEEE21_M_insert_unique_nodeEmmPNS4_10_Hash_nodeIS2_Lb0EEE+0x129)[0x116d2a9]
Someone to help?
Aucun commentaire:
Enregistrer un commentaire