Skip to content

Commit 49876f4

Browse files
committed
Add some hints to the README
1 parent 495b4b1 commit 49876f4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ Note that this tells you where the lost bytes were
261261
be *freed*, as that's going to depend on how they're used after they're
262262
allocated.
263263

264+
:warning: not all of these output blocks will be useful. Look for ones that
265+
refer to some of _your_ code somewhere, like `strip` or `is_clean`.
266+
264267
There are two common types of memory leaks, one of which is frankly easier to
265268
sort out than the other.
266269

@@ -292,6 +295,24 @@ test code (you could always just change the test code to say everything
292295
passes!), but if the memory leaks to the test code, then that's where the
293296
fix has to be made.
294297

298+
:raising_hand: **Tip:** If you need to free a value and you don't have a
299+
name for it, _give it one_. E.g., add an assignment statement like
300+
`s = value_to_free()` that gives that value (`value_to_free()`) a name
301+
(`s`) so you can free it with something like `free(s)`. Also, don't forget
302+
how to write clean code just because you're using C. If you find yourself
303+
with multiple functions with the same structure, is there a way you can
304+
write a helper function that captures that structure so you don't have to
305+
repeat it over and over?
306+
307+
Once you have everything happy, you will hopefully get a line like:
308+
309+
```text
310+
==357046== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
311+
312+
```
313+
314+
at the end indicating that you now have 0 errors and all is well.
315+
295316
## What to do
296317

297318
- [ ] Compile the program `check_whitespace`

0 commit comments

Comments
 (0)