mini_racer 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -0
- data/ext/mini_racer_extension/mini_racer_extension.cc +38 -5
- data/lib/mini_racer.rb +2 -2
- data/lib/mini_racer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 99d9eecfd656415e7b78e2dc350e74fa48efff6ba59c0753435acbcb354a6f1f
|
|
4
|
+
data.tar.gz: 5569cf7c40958530af9326e0a73240bbe564eeca8242b4e254fbb72088134de1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2460052cf2bff6b6b6e7ad0971830d409daf71e7e2f6e7c6c15270378ac83758f38d31b24a48ff7eeb4108be6eff012bd8f762f85a2aa2b8f31e96e8f7207719
|
|
7
|
+
data.tar.gz: e94abed7909184fa5c2d982cdffbc751731fe9f1618a543842631660380c8fcba77cc5fba3b6b6337d94531f1738f19c6b66c00753e62aa0314179317f8a798a
|
data/CHANGELOG
CHANGED
|
@@ -70,6 +70,10 @@ public:
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
int refs() {
|
|
74
|
+
return refs_count;
|
|
75
|
+
}
|
|
76
|
+
|
|
73
77
|
static void* operator new(size_t size) {
|
|
74
78
|
return ruby_xmalloc(size);
|
|
75
79
|
}
|
|
@@ -1071,21 +1075,50 @@ void free_isolate(IsolateInfo* isolate_info) {
|
|
|
1071
1075
|
delete isolate_info->allocator;
|
|
1072
1076
|
}
|
|
1073
1077
|
|
|
1078
|
+
static void *free_context_raw(void* arg) {
|
|
1079
|
+
ContextInfo* context_info = (ContextInfo*)arg;
|
|
1080
|
+
IsolateInfo* isolate_info = context_info->isolate_info;
|
|
1081
|
+
Persistent<Context>* context = context_info->context;
|
|
1082
|
+
|
|
1083
|
+
if (context && isolate_info && isolate_info->isolate) {
|
|
1084
|
+
Locker lock(isolate_info->isolate);
|
|
1085
|
+
v8::Isolate::Scope isolate_scope(isolate_info->isolate);
|
|
1086
|
+
context->Reset();
|
|
1087
|
+
delete context;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
if (isolate_info) {
|
|
1091
|
+
isolate_info->release();
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
xfree(context_info);
|
|
1095
|
+
return NULL;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1074
1098
|
// destroys everything except freeing the ContextInfo struct (see deallocate())
|
|
1075
1099
|
static void free_context(ContextInfo* context_info) {
|
|
1076
1100
|
|
|
1077
1101
|
IsolateInfo* isolate_info = context_info->isolate_info;
|
|
1078
1102
|
|
|
1103
|
+
ContextInfo* context_info_copy = ALLOC(ContextInfo);
|
|
1104
|
+
context_info_copy->isolate_info = context_info->isolate_info;
|
|
1105
|
+
context_info_copy->context = context_info->context;
|
|
1106
|
+
|
|
1107
|
+
if (isolate_info && isolate_info->refs() > 1) {
|
|
1108
|
+
pthread_t free_context_thread;
|
|
1109
|
+
if (pthread_create(&free_context_thread, NULL, free_context_raw, (void*)context_info_copy)) {
|
|
1110
|
+
fprintf(stderr, "WARNING failed to release memory in MiniRacer, thread to release could not be created, process will leak memory\n");
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
} else {
|
|
1114
|
+
free_context_raw(context_info_copy);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1079
1117
|
if (context_info->context && isolate_info && isolate_info->isolate) {
|
|
1080
|
-
Locker lock(isolate_info->isolate);
|
|
1081
|
-
v8::Isolate::Scope isolate_scope(isolate_info->isolate);
|
|
1082
|
-
context_info->context->Reset();
|
|
1083
|
-
delete context_info->context;
|
|
1084
1118
|
context_info->context = NULL;
|
|
1085
1119
|
}
|
|
1086
1120
|
|
|
1087
1121
|
if (isolate_info) {
|
|
1088
|
-
isolate_info->release();
|
|
1089
1122
|
context_info->isolate_info = NULL;
|
|
1090
1123
|
}
|
|
1091
1124
|
}
|
data/lib/mini_racer.rb
CHANGED
|
@@ -320,7 +320,7 @@ module MiniRacer
|
|
|
320
320
|
ctx = MiniRacer::Context.new
|
|
321
321
|
ctx.eval(str)
|
|
322
322
|
rescue MiniRacer::RuntimeError => e
|
|
323
|
-
raise MiniRacer::SnapshotError.new,
|
|
323
|
+
raise MiniRacer::SnapshotError.new, e.message, e.backtrace
|
|
324
324
|
end
|
|
325
325
|
|
|
326
326
|
@source = str
|
|
@@ -338,7 +338,7 @@ module MiniRacer
|
|
|
338
338
|
ctx.eval(@source)
|
|
339
339
|
ctx.eval(src)
|
|
340
340
|
rescue MiniRacer::RuntimeError => e
|
|
341
|
-
raise MiniRacer::SnapshotError.new,
|
|
341
|
+
raise MiniRacer::SnapshotError.new, e.message, e.backtrace
|
|
342
342
|
end
|
|
343
343
|
|
|
344
344
|
warmup_unsafe!(src)
|
data/lib/mini_racer/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mini_racer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sam Saffron
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-11-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|