Curated articles, resources, tips and trends from the DevOps World.
Summary: This is a summary of an article originally published by the source. Read the full original article here →
One of the fundamental things you need to know as a software engineer is how the stack and heap work. Today we will address one of the most common questions which is what happens when the stack and the heap collide.
When the stack and heap collide, it means that both memory regions start overlapping with each other.
When main() tries to use the pointer variable after calling func(), it can result in unexpected behavior if the stack and heap overlap.
func() re-assigns the passed pointer variable to another pointer on the stack and frees the heap memory.
Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com