0

If I understand correctly, the RAM is virtually divided into stack and heap. Stack takes primitive types/functions etc and Heap deals with the reference types and objects. Stack follows the LIFO principle.

Since everything the computer saves goes to memory, where do stack and heap come into play in that case? Like, let's say saving some text to a notepad. Does it go to stack or heap?

Edit: I guess all I am asking is, is this statement correct?

"At a fundamental level, all programs and apps, including built-in ones like notepad, rely on memory management mechanisms like the stack and heap to store and manage data. Example: the stack and heap are being used to control features of notepad like lets say tracking the cursor position, the text I have entered, and various other parameters."

3
  • it is up to application, but stack usually has fixed size, so for data of unknown size (like text in notepad) applications usually use heap, we don't have notepad source code, but I'd assume it uses heap for actual text. also, notepad uses standard edit control, which allocates its own memory - so probably notepad even not storing text by itself, but just relies on internal edit's buffer, which is dynamic, which means on heap Commented Jan 20, 2024 at 14:30
  • @IłyaBursov What about properties like undo or clipboard property, do they use stack memory? Commented Jan 20, 2024 at 15:48
  • neither undo nor clipboard is property, they are features implemented with some data structures, memory for these data structures usually go to heap, again because they're not fixed size Commented Jan 20, 2024 at 20:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.