Comments (1)
I found another example. That's easier to understand.
This goes in onWindowReady
JavascriptClassDefinition oneClassDef = new JavascriptClassDefinition().name("one").attributes(JavascriptClassAttributes.NO_AUTOMATIC_PROTOTYPE);
JavascriptClass oneClass = oneClassDef.bake();
JavascriptObject oneObject = context.makeObject(oneClass);
globalObject.setProperty("one", oneObject, 0);
JavascriptClassDefinition twoClassDef = new JavascriptClassDefinition().name("two").parentClass(oneClass).attributes(JavascriptClassAttributes.NO_AUTOMATIC_PROTOTYPE);
JavascriptClass twoClass = twoClassDef.bake();
JavascriptObject twoObject = context.makeObject(twoClass);
oneObject.setProperty("two", twoObject, 0);
JavascriptClassDefinition threeClassDef = new JavascriptClassDefinition().name("three").parentClass(twoClass).attributes(JavascriptClassAttributes.NO_AUTOMATIC_PROTOTYPE);
threeClassDef.onCallAsFunction(new JavascriptObjectFunction() {
@Override
public JavascriptValue callAsJavascriptFunction(JavascriptContext context, JavascriptObject function, JavascriptObject thisObject, JavascriptValue[] arguments) throws JavascriptInteropException {
if (true) {
JavascriptValue string = context.makeString("[{\"x\":-156.5,\"z\":265.5,\"type\":5},{\"x\":-158.5,\"z\":265.5,\"type\":5},{\"x\":-152.5,\"z\":267.5,\"type\":5},{\"x\":-160.5,\"z\":267.5,\"type\":5},{\"x\":-148.5,\"z\":267.5,\"type\":5},{\"x\":-150.5,\"z\":267.5,\"type\":5},{\"x\":-160.5,\"z\":265.5,\"type\":5},{\"x\":-154.5,\"z\":267.5,\"type\":5},{\"x\":-154.5,\"z\":265.5,\"type\":5},{\"x\":-152.5,\"z\":265.5,\"type\":5},{\"x\":-150.5,\"z\":265.5,\"type\":5},{\"x\":-158.5,\"z\":267.5,\"type\":5},{\"x\":-171.31021364279692,\"z\":240.2766290600617,\"type\":0},{\"x\":-162.5,\"z\":265.5,\"type\":5},{\"x\":-156.5,\"z\":267.5,\"type\":5},{\"x\":-148.5,\"z\":265.5,\"type\":5},{\"x\":-155.44999998807907,\"z\":272.44999998807907,\"type\":3},{\"x\":-162.5,\"z\":267.5,\"type\":5},{\"x\":-242.5,\"z\":242.5,\"type\":4}]");
//string.contextUnlocking();
return string;
}
return context.makeBoolean(false);
}
});
JavascriptClass threeClass = threeClassDef.bake();
JavascriptObject threeObject = context.makeObject(threeClass);
twoObject.setProperty("three", threeObject, 0);
this exaggerates the memory leak, calls one.two.three a crap ton and task manager shows memory increasing by about 150MB per second. Looking at VisualVM shows that all objects java side are being correctly garbage collected. There must be something natively that is not releasing some memory?
function update() {
for (let index = 0; index < 2500; index++) {
// @ts-ignore
let f = one.two.three("");
// @ts-ignore
let f1 = one.two.three("");
// @ts-ignore
let f2 = one.two.three("");
}
}
function animationFrame() {
update();
requestAnimationFrame(animationFrame);
}
requestAnimationFrame(animationFrame);
from ultralight-java.
Related Issues (20)
- Convert Javascript functions to functional interfaces if possible
- Project cleanup
- Create Swing and JavaFX integration HOT 2
- Remove dependency on AppCore
- Fix performance issues with JNI and garbage collection
- Support Java 9 JPMS HOT 5
- Finish GPU Driver integration HOT 1
- Add YourKit Reference to README
- Upgrade to Ultralight 1.3
- add native gpu driver HOT 1
- Add better examples
- doubleClick occurs crash HOT 2
- EXCEPTION ACCESS VIOLATION Crash || And Inti Page low FPS
- Natives fail to load HOT 3
- Is this still maintained ? HOT 8
- How to set up custom rendering in divs HOT 2
- Cannot run program "cmake" HOT 1
- The specified procedure could not be found
- LIBRARY MOVED!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ultralight-java.