@@ -20,7 +20,7 @@ knitr::opts_chunk$set(
20
20
21
21
22
22
In this chapter, we will talk about memory. How does Zig controls memory? What
23
- commom tools are used? Are there any important aspect that makes memory
23
+ common tools are used? Are there any important aspect that makes memory
24
24
different/special in Zig? You will find the answers here.
25
25
26
26
Every computer needs memory. Is by having memory that computers can temporarily store
@@ -153,7 +153,7 @@ probably have heard of the "duel" between Stack vs Heap. These are two different
153
153
or different memory spaces, which are both available in Zig.
154
154
155
155
These two types of memory don't actually duel with
156
- each other. This is a commom mistake that beginners have, when seeing "x vs y" styles of
156
+ each other. This is a common mistake that beginners have, when seeing "x vs y" styles of
157
157
tabloid headlines. These two types of memory are actually complementary to each other.
158
158
So, in almost every Zig program that you ever write, you will likely use a combination of both.
159
159
I will describe each memory space in detail over the next sections. But for now, I just want to
@@ -461,7 +461,7 @@ a space in the stack is reserved for this function call. But the stack
461
461
have a key limitation which is: every object stored in the stack have a
462
462
known fixed length.
463
463
464
- But in reality, there are two very commom instances where this "fixed length limitation" of the stack is a deal braker:
464
+ But in reality, there are two very common instances where this "fixed length limitation" of the stack is a deal braker:
465
465
466
466
1 . the objects that you create inside your function might grow in size during the execution of the function.
467
467
@@ -473,7 +473,7 @@ stack. However, if this object is stored in the heap, then, you can return a poi
473
473
end of the function. Because you (the programmer) control the lyfetime of any heap memory that you allocate. You decide
474
474
when this memory get's destroyed/freed.
475
475
476
- These are commom situations where the stack is not good for.
476
+ These are common situations where the stack is not good for.
477
477
That is why you need a different memory management strategy to
478
478
store these objects inside your function. You need to use
479
479
a memory type that can grow together with your objects, or that you
0 commit comments