Comments (3)
Hi @avonwyss . This is the wiki detailing ChakraCore's memory management. I added a small para at the end for .NET.
Specifically, the .NET GC was collecting delegates which had been passed to ChakraCore (in my case through JsCreateFunction and JsSetPromiseContinuationCallback), which made it so that all unit tests were running fine but when running in the application with some memory pressure things started go awry.
The AV problem you mentioned is indeed because .NET GC is not aware of ChakraCore GC references. There were some discussions long ago about how to get around that.
ChakraCore telling me that it was running on the wrong thread
Is a different issue because of ChakraCore's rental threading design.
from chakra-samples.
Hi @liminzhu
Thank you for the quick reaction. I think it would be best to somehow include this into the .NET samples, which is why I posted it here.
Regarding the wrong thread error, in my case it was really caused by the memory corruption; I had locks around every single access to JS context and the problem was intermittent with the AV errors. Also, it did not behave the same with and without debugger (got the wrong thread usually without debugger, and AV with debugger).
Note that pinning is not necessary and not advisable, keeping a Normal
GCHandle is entierly sufficient. See also the GCHandleType docs.
from chakra-samples.
I think it would be best to somehow include this into the .NET samples, which is why I posted it here.
Generally agree with your sentiment. Will try to come up with some short code snippet and documentation as said in microsoft/ChakraCore-wiki#5. Meanwhile, feel free to send a PR against Chakra-samples if you're interested in getting a sample online
Regarding the wrong thread error, in my case it was really caused by the memory corruption; I had locks around every single access to JS context and the problem was intermittent with the AV errors. Also, it did not behave the same with and without debugger (got the wrong thread usually without debugger, and AV with debugger).
Do you have a short repro I can play with? I would love to look more into it.
Note that pinning is not necessary and not advisable, keeping a Normal GCHandle is entierly sufficient. See also the GCHandleType docs.
Yep, I meant extending the lifetime at least till callback/object is no longer needed.
from chakra-samples.
Related Issues (20)
- Adding items to a JS array using CallFunction doesn't add HOT 1
- Add ref to task in PromiseContinuationCallback HOT 1
- how to use third party js library? HOT 3
- Debugger (Local window) crashes when JavaScriptPropertyId is a local variable
- Enable beta features HOT 2
- Multi-thread code samples request HOT 6
- Any plan to support OSX in "JSRT Hosting Samples" HOT 1
- Linux_OSX_Shared/Sample.cpp Build Error HOT 4
- Unable to run the sample app in Linux HOT 4
- Updated helloWorld.py HOT 3
- C# Sample Updates HOT 3
- Generate a Class and Instance in C# HOT 1
- Q: TypeScript ? is it possible HOT 3
- Reuse parsing result HOT 1
- JsProjectWinrtNamespace sample not working in UWP Library
- Need help with C# Native.JsRunScript and async
- Linux/MacOS create function with return sample
- Move CharkaCore samples to chakra-core org
- This repo is missing important files HOT 1
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 chakra-samples.