Title: [WASM] How would a VirtualMachine class work for binding to JS? · Issue #262 · RustPython/RustPython · GitHub
Open Graph Title: [WASM] How would a VirtualMachine class work for binding to JS? · Issue #262 · RustPython/RustPython
X Title: [WASM] How would a VirtualMachine class work for binding to JS? · Issue #262 · RustPython/RustPython
Description: Given that a VirtualMachine could potentially take up a lot of memory, what would be the smartest way to make a JS class to manage it? The pyEval function is sufficient for simple things, but it might be desirable to persist the context ...
Open Graph Description: Given that a VirtualMachine could potentially take up a lot of memory, what would be the smartest way to make a JS class to manage it? The pyEval function is sufficient for simple things, but it mi...
X Description: Given that a VirtualMachine could potentially take up a lot of memory, what would be the smartest way to make a JS class to manage it? The pyEval function is sufficient for simple things, but it mi...
Opengraph URL: https://github.com/RustPython/RustPython/issues/262
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[WASM] How would a VirtualMachine class work for binding to JS?","articleBody":"Given that a `VirtualMachine` could potentially take up a lot of memory, what would be the smartest way to make a JS class to manage it? The `pyEval` function is sufficient for simple things, but it might be desirable to persist the context over, e.g. for a REPL.\r\n\r\nI see two or three ways to do this:\r\n- Hold created `VirtualMachines` in a global HashMap by randomly generated IDs, and have a `.destroy()` method on the JS class that has to be called or risk a memory leak.\r\n- Only allow one `VirtualMachine` per JS context, held in a global variable, initialized at load.\r\n- Implement a way for the entire Python context to be serialized (probably not feasible at the moment, nor necessarily worth the time).\r\n\r\nI considered some stuff with maybe JS `WeakSet`s or `WeakMap`s (that take an object as a key but don't prevent it or its value from being garbage-collected), but I don't think that would be able to do anything.","author":{"url":"https://github.com/coolreader18","@type":"Person","name":"coolreader18"},"datePublished":"2019-01-28T02:14:16.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/262/RustPython/issues/262"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:05babb6f-6ae9-5230-fe97-f95443dc6e4a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 85F8:15B7F2:AF3B68:100DE8D:6A58A2B0 |
| html-safe-nonce | 2081d71923b5c8bc4e2db250bd28234f2d7e13bc945d0ffaa5292d3442a73b32 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NUY4OjE1QjdGMjpBRjNCNjg6MTAwREU4RDo2QTU4QTJCMCIsInZpc2l0b3JfaWQiOiI0NTY1NjA5NTM4MDQ1NjQ5NTg0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1262bd3fcc72f9243b9e1e7237e8585d53e587673cfcc2900c8d3978ba576776 |
| hovercard-subject-tag | issue:403626010 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/RustPython/RustPython/262/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ac78ff032854d24afdf9de92b66eefa18f762b85eccc2596ea0349c0d0498518/RustPython/RustPython/issues/262 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ac78ff032854d24afdf9de92b66eefa18f762b85eccc2596ea0349c0d0498518/RustPython/RustPython/issues/262 |
| og:image:alt | Given that a VirtualMachine could potentially take up a lot of memory, what would be the smartest way to make a JS class to manage it? The pyEval function is sufficient for simple things, but it mi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | coolreader18 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6 |
| turbo-cache-control | no-preview |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8aae7b8d6caacacf5c66eaeb2702d8dc88d85b4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width