Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rust Stack vs Heap usage

Deepu K Sasidharan
March 29, 2020
59k

Rust Stack vs Heap usage

Deepu K Sasidharan

March 29, 2020
Tweet

Transcript

  1. Rust Memory usage
    Heap
    Thread stack
    main frame

    View full-size slide

  2. Rust Memory usage
    Heap
    Thread stack
    main frame
    john
    Employee:new
    name
    salary 5000
    sales 5
    bonus 0
    Box<“John”>

    View full-size slide

  3. Rust Memory usage
    Heap
    Thread stack
    main frame
    john
    name
    salary 5000
    sales 5
    bonus 0
    Box<“John”>

    View full-size slide

  4. Rust Memory usage
    Heap
    Thread stack
    main frame
    john
    name
    salary 5000
    sales 5
    bonus 0
    Box<“John”>
    find_employee_bonus
    salary
    no_of_sales 5

    View full-size slide

  5. Rust Memory usage
    Heap
    Thread stack
    main frame
    john
    name
    salary 5000
    sales 5
    bonus 0
    Box<“John”>
    find_employee_bonus
    salary
    no_of_sales 5
    bonus_percentage 0

    View full-size slide

  6. Rust Memory usage
    Heap
    Thread stack
    main frame
    john
    name
    salary 5000
    sales 5
    bonus 0
    Box<“John”>
    find_employee_bonus
    salary
    no_of_sales 5
    bonus_percentage 0
    get_bonus_percentage
    salary

    View full-size slide

  7. Rust Memory usage
    Heap
    Thread stack
    main frame
    john
    name
    salary 5000
    sales 5
    bonus 0
    Box<“John”>
    find_employee_bonus
    salary
    no_of_sales 5
    bonus_percentage 0
    get_bonus_percentage
    salary
    percentage 500

    View full-size slide

  8. Rust Memory usage
    Heap
    Thread stack
    main frame
    john
    name
    salary 5000
    sales 5
    bonus 0
    Box<“John”>
    find_employee_bonus
    salary
    no_of_sales 5
    bonus_percentage 0
    get_bonus_percentage
    salary
    percentage 500
    return 500

    View full-size slide

  9. Rust Memory usage
    Heap
    Thread stack
    main frame
    john
    name
    salary 5000
    sales 5
    bonus 0
    Box<“John”>
    find_employee_bonus
    salary
    no_of_sales 5
    bonus_percentage 500

    View full-size slide

  10. Rust Memory usage
    Heap
    Thread stack
    main frame
    john
    name
    salary 5000
    sales 5
    bonus 0
    Box<“John”>
    find_employee_bonus
    salary
    no_of_sales 5
    bonus_percentage 500
    bonus 2500

    View full-size slide

  11. Rust Memory usage
    Heap
    Thread stack
    main frame
    john
    name
    salary 5000
    sales 5
    bonus 0
    Box<“John”>
    find_employee_bonus
    salary
    no_of_sales 5
    bonus_percentage 500
    bonus 2500
    return 2500

    View full-size slide

  12. Rust Memory usage
    Heap
    Thread stack
    main frame
    john
    name
    salary 5000
    sales 5
    bonus 2500
    Box<“John”>

    View full-size slide

  13. Rust Memory usage
    Heap
    Thread stack

    View full-size slide