Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Management - Reusing space #45

Open
Dwctor opened this issue Sep 14, 2023 · 0 comments
Open

Memory Management - Reusing space #45

Dwctor opened this issue Sep 14, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Dwctor
Copy link
Collaborator

Dwctor commented Sep 14, 2023

Currently when Honey Potion translates code, we often create a "result" variable that keeps the result of an operation. As a barebones example, we could have:

    result = Operation(...) # Result is alive.
    ...                     |
    use(result)             # Result dies here.
    ...
    result2 = Operations(...) # Result 2 is alive.
    ...                       |
    use(result2)              # Result 2 dies here.

It is easy to notice that both variables have no intersection (The lines marked by #----#), which means that both could use the same memory space. Here is an example where a memory space is represented by a variable.

    memspace1 = Operation(...)     # Result is alive. Uses memspace1
    ...                            |
    use(memspace1)                 # Result dies here. Liberates memspace1
    ...
    memspace1 = Operations(...)    # Result 2 is alive. Uses the liberated memspace1
    ...                            |
    use(memspace1)                 # Result 2 dies here. Liberates memspace1 once again

However, currently we keep creating new variables instead of reusing the old space, which makes using up the 512 byte stack limit of eBPF much easier. As a way to make our programs significantly bigger, we wish to reuse space with cleverer Memory Management going forward.

This issue should start being worked on after the new translation discussed on #39 and should integrate with the liveness analysis that is already in Honey Potion.

@Dwctor Dwctor added the enhancement New feature or request label Sep 14, 2023
@Dwctor Dwctor self-assigned this Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant