summaryrefslogtreecommitdiff
path: root/src/tests/eolian_js
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2016-03-16 19:46:22 -0300
committerVitor Sousa <vitorsousasilva@gmail.com>2016-03-18 17:47:09 -0300
commitafb66463937a8d08e2bf1d538641a9520ba457d6 (patch)
tree10a0a55ee9301ef195434a4411b7b0af02793365 /src/tests/eolian_js
parenta6025b5d27f98b8595a1eb33f8f24fe998af8b90 (diff)
efl js: Add clean up callbacks to deallocate memory used in v8::External
Add several garbage collector callbacks for cleaning allocated C and C++ data used inside v8:External objects. Fix eo_unref of already freed object in eo_js_construct_from_eo.hh. Ensure all structs are allocated with malloc. Add test for garbage collection. Had to created .sh script because shebang clause do not support multiple arguments.
Diffstat (limited to 'src/tests/eolian_js')
-rwxr-xr-xsrc/tests/eolian_js/eolian_js_suite.js16
-rwxr-xr-xsrc/tests/eolian_js/eolian_js_suite.sh4
2 files changed, 20 insertions, 0 deletions
diff --git a/src/tests/eolian_js/eolian_js_suite.js b/src/tests/eolian_js/eolian_js_suite.js
index 66e5596..2c45eb3 100755
--- a/src/tests/eolian_js/eolian_js_suite.js
+++ b/src/tests/eolian_js/eolian_js_suite.js
@@ -795,6 +795,22 @@ startTest("method_iterator_of_structs", function() {
795// assert(a[0] === 42); 795// assert(a[0] === 42);
796// }); 796// });
797 797
798// Garbage Collection //
799startTest("gc_object", function() {
800 var freed = false;
801 (function() {
802 var obj = new TestObject(null);
803 obj.on("del", function() {
804 printInfo('Object destructed')
805 freed = true;
806 });
807 }());
808 printInfo('going to garbage collect');
809 global.gc();
810 printInfo('is object destructed?');
811 assert(freed);
812});
813
798startTest("new Constructor_Method_Class", function() { 814startTest("new Constructor_Method_Class", function() {
799 var obj = new ConstructorMethodClass(null, 5, 10.0); 815 var obj = new ConstructorMethodClass(null, 5, 10.0);
800 assert(obj); 816 assert(obj);
diff --git a/src/tests/eolian_js/eolian_js_suite.sh b/src/tests/eolian_js/eolian_js_suite.sh
new file mode 100755
index 0000000..6b78a50
--- /dev/null
+++ b/src/tests/eolian_js/eolian_js_suite.sh
@@ -0,0 +1,4 @@
1#!/bin/sh
2
3BASEDIR=$(dirname $0)
4/usr/bin/env node --expose-gc $BASEDIR/eolian_js_suite.js