v8

NodeJS memory consumption in an infinite loop

限于喜欢 提交于 2019-12-03 05:28:37
I don't know if this is a bug with Node or V8, but if I run the following code the node process leaks memory. The GC never seems to kick in and in a few seconds it's consuming >1GB of memory. This is unexpected behavior. Am I missing something? Here's the code: for(;;) { console.log(1+1); } Obviously, this is a little bit of a contrived situation, but I can see an issue with a long-running process that would never free memory. Edit: I tried both with v0.5.10 (unstable) and v0.4.12 (stable) and the unstable version performs a little bit better---the stable version just stops outputting to the

Is node.js a viable alternative to traditional scripting languages like Perl and Python? [closed]

我的梦境 提交于 2019-12-03 05:23:20
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Recently I've fallen out of love with Perl as a cross-platform general purpose scripting language, and niether Python nor Ruby ever really appealed to me either. But I've been getting more and more comfortable with JavaScript in the browser, it's getting

What is in Object.__proto__?

瘦欲@ 提交于 2019-12-03 05:16:01
问题 In Google Chrom's javascript, objects have a property named __proto__ that points to their prototype (or parent) object. var foo = {}; console.log(foo.__proto__ === Object.prototype); //returns true However, this is not true for the Object object. console.log(Object.__proto__ === Object.prototype); //returns false The Object.__proto__ property appears to be an empty method > console.log(Object.__proto__.toString()); function () {} Beyond serving as a warning story about relying on javascript

is there any workaround for broken v8 date parser?

不想你离开。 提交于 2019-12-03 04:55:35
V8 Date parser is broken: > new Date('asd qw 101') Sat Jan 01 101 00:00:00 GMT+0100 (CET) I can use fragile regular expression like this: \d{1,2} (jan|feb|mar|may|jun|jul|aug|sep|oct|nov|dec) \d{1,4} but it is too fragile. I cannot rely on new Date (issue in V8) and also moment cant help me because moment is getting rid off date detection (github issue-thread) . is there any workaround for broken v8 date parser? To be clear. We have Gecko and V8, both have Date . V8 has broken Date, Gecko has working one. I need the Date from in Gecko (Firefox). Update: It’s definitely broken parser https:/

node.js in Eclipse - which plugin(s) are most people using?

℡╲_俬逩灬. 提交于 2019-12-03 04:44:16
问题 I'm mostly interested in server-side web development, though being able to redeploy some bits in Chrome would be nice. I am currently running Eclipse Indigo on Ubuntu for developing mostly Java/Scala programs and to use git. So far I've come across http://code.google.com/p/chromedevtools/ and https://www.ebayopensource.org/index.php/VJET/HomePage, but not sure which is preferable. 回答1: There is Nodeclipse.org effort. Current version is 0.16 update site is http://www.nodeclipse.org/updates/

How to embed V8 in a Java application?

吃可爱长大的小学妹 提交于 2019-12-03 03:56:48
问题 I'm looking for a solution for embedding the Google JavaScript engine V8 in my Java application. Have you got some solutions? 回答1: You can use J2V8 https://github.com/eclipsesource/J2V8. It's even available in Maven Central. Below is a Hello, World! program using J2V8. package com.example; import com.eclipsesource.v8.V8; public class EclipseCon_snippet5 { public static class Printer { public void print(String string) { System.out.println(string); } } public static void main(String[] args) {

Perl: Javascript::V8 templates - from the perl

女生的网名这么多〃 提交于 2019-12-03 03:15:16
Looking for template engine like HTML::Mason (or Mason), so what "compiles" source components into perl code, but instead of perl-code will "compile" components into JavaScript code and after run/execute them with Javascript::V8 perl module. Motivation: Looking for solution for safe template language, what can edit users without compromising the server security . JavaScript is full featured language so using it is probably better/faster than some "mini languages" like TT or similar. The best for me would be an extension (rewrite) of Mason for compiling into Joose/JavaScript instead of Moose

Couldn't load (find) j2v8_android_x86 library

匿名 (未验证) 提交于 2019-12-03 03:12:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a gradle project that uses j2v8_android 2.2.1 library (which provides Java bindings for V8 JS engine - android port). Unfortunately, after executing the project (build succeeds without issues), I get an exception related to missing j2v8_android_x86 library file. The issues occurs when trying to create V8 runtime: V8 runtime = V8.createV8Runtime(); The exception itself is: Caused by: java.lang.IllegalStateException: J2V8 native library not loaded. at com.eclipsesource.v8.V8.checkNativeLibraryLoaded(V8.java:86) at com.eclipsesource.v8

How to convert v8 Value to Array

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm writing a c++ extension to v8, and want to pass an Array object into it. I see the incoming argument can be tested by IsArray(), but there isn't a ToArray(). How do you get access to its Length, and request elements by numeric index? Handle < Value > MyExtension ( const Arguments & args ) { Handle < Value > v = args [ 0 ]; if ( v -> IsArray ()) { // convert to array, find its length, and access its members by index... ? } ... } Must be missing something obvious here. Object can return all its properties, but that's not quite

Where can I see the source code for JavaScript methods, such as hasOwnProperty, in Node.js?

主宰稳场 提交于 2019-12-03 02:24:31
I have been studying JavaScript algorithms and Big O for interviews. I was told that knowing the runtimes of built-in methods, such as Object.prototype.hasOwnProperty and Array.prototype.map , is important. What is a simple way to view the source code for these functions in node.js? I have a local copy of node.js, and I tried to search for these methods in my text editor, but it's not as straightforward as I thought. Object.prototype.hasOwnProperty() From a Javascript interview point of view, I would think you just need to fully understand what obj.hasOwnProperty() does at the Javascript level