$30 off During Our Annual Pro Sale. View Details »

Golang Memory usage(Stack vs Heap)

Golang Memory usage(Stack vs Heap)

Deepu K Sasidharan

February 12, 2020
Tweet

More Decks by Deepu K Sasidharan

Other Decks in Technology

Transcript

  1. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    BONUS_PERCENTAGE 10

    View Slide

  2. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10
    Employee:new
    name “John”
    salary 5000
    sales 5
    bonus 0

    View Slide

  3. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10

    View Slide

  4. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10
    findEmployeeBonus
    salary 5000
    noOfSales 5

    View Slide

  5. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10
    findEmployeeBonus
    salary 5000
    noOfSales 5
    bonusPercentage 0

    View Slide

  6. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10
    findEmployeeBonus
    salary 5000
    noOfSales 5
    bonusPercentage 0
    getBonusPercentage
    salary 5000

    View Slide

  7. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10
    findEmployeeBonus
    salary 5000
    noOfSales 5
    bonusPercentage 0
    getBonusPercentage
    salary 5000
    percentage 500

    View Slide

  8. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10
    findEmployeeBonus
    salary 5000
    noOfSales 5
    bonusPercentage 0
    getBonusPercentage
    salary 5000
    percentage 500
    return 500

    View Slide

  9. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10
    findEmployeeBonus
    salary 5000
    noOfSales 5
    bonusPercentage 500

    View Slide

  10. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10
    findEmployeeBonus
    salary 5000
    noOfSales 5
    bonusPercentage 500
    bonus 2500

    View Slide

  11. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10
    findEmployeeBonus
    salary 5000
    noOfSales 5
    bonusPercentage 500
    bonus 2500
    return 2500

    View Slide

  12. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10
    mspan
    Employee
    name “John”
    salary 5000
    sales 5
    bonus 2500

    View Slide

  13. Go Memory usage
    Heap
    Goroutine stack
    P1 mcache
    main frame
    john
    BONUS_PERCENTAGE 10
    mspan
    Employee
    name “John”
    salary 5000
    sales 5
    bonus 2500

    View Slide