Eliah-Lakhin / ad-astra

Scripting language for Rust.
https://ad-astra.lakhin.com/
75 stars 0 forks source link

Advanced Isolations #5

Open Eliah-Lakhin opened 1 day ago

Eliah-Lakhin commented 1 day ago

Currently, the only isolation feature Ad Astra provides is a per-thread evaluation hook that allows users to manually control and interrupt a script's control flow.

However, users should also be able to configure stack usage limits, borrowing limits, and heap memory limits. These features should potentially be configurable on a per-thread basis as well.

Additionally, the Ad Astra engine uses a single implicit global memory heap for all scripts, which persists throughout the process lifetime. While this design is convenient for end users, it introduces potential issues, particularly a lack of control over heap memory leaks.

To address these issues, users should have the ability to manually set up memory heaps (i.e., heap arenas) and manage their cleanup. In principle, heap cleanup is safe because script references (Cells) can be converted into weak references tied to the currently configured heaps.