Examples of using Malloc in English and their translations into Slovak
{-}
-
Programming
-
Colloquial
-
Official
-
Medicine
-
Financial
-
Ecclesiastic
-
Official/political
-
Computer
We're not using malloc.
Malloc, but I haven't actually.
When you called malloc.
So malloc is, again, this function.
Allocated or asked malloc for.
And in particular, malloc is therefore returning what?
By calling a function, called malloc.
What is malloc? What it's strlen? What is sizeof(char)?
What's happened is, when I call malloc.
The functions malloc and free are often used in the C Programming Language.
Well, all this time, you have been using malloc.
We're not using malloc, we're using the week 2 approach of just declaring an array.
Well, even though there's a lot of parentheses here, malloc takes just a single argument.
So malloc is, again, this function that just allocates memory, memory allocation.
And now, on the right-hand side, malloc, of course, is allocating a chunk of memory.
The onus is on me to remember how much memory I actually allocated orasked malloc for.
Reducing malloc traffic has had far greater effect than trying to optimize the actual allocator itself.
It means it getsa chunk of memory from the operating system by calling a function, called malloc.
But malloc specifically returns the address of that chunk of memory, which you have just proposed gets stored in x.
Just t, because what's happened this time, if I slightly undo that last step, what's happened is,when I call malloc, I essentially get a chunk of memory that is the same size as the original, because that's the arithmetic I did.
The value part must be malloc'ed manually because the memory management code will try to free this pointer later.
So even though I have allocated a char star that's no longer called s, it's instead called, buffer-- so let's draw the variable's name now as buffer--if I haven't called getString or malloc here, that effectively means that buffer is just some garbage value.
Moreover, it will also tell me, as we will see, as you run this in a future pset, if and when you have leaked memory, which indeed I have, because I have called malloc, but I haven't actually called, in this case, free, which we will eventually see is the opposite of malloc.