Saturday, July 26, 2014

Stress

My exercice program for pset6 gets a clean bill of health on memory from
Valgrind when I integrate a free memory program:
 
 
 

 
When I remove the call to this function in the program, I have not actually leaked memory but there
is still heap memory occupied at the end of the run.


Heap memory, it will be recalled , is leftover reserve memory when one discounts the stack.
The thing about the stack is that it cleans up after itself: everything disappears once the
particular function has run. Not so with the heap.

The situation is not serious; this memory is 'reachable'. But poor form.

What happens when the program terminates? In a modern os, memory should be released. So
we have a memory problem so long as the program runs (and it might be a background task, or
a program on an embedded device with little memory...etc). Thus, a de facto memory leak.

This usage of Valgrind is the default; i.e. memory leakage. It can much more sophisticated
things , handle large programs , integrate gdb for debugging and so forth. One appreciates such features when one needs them and pros  end up 'learning' how to use such software a good deal of their time, I would guess in stressfull situations...

The Vim code editor is much appreciated because it runs the same on all platforms. It is customizable
and well documented. Here is my Binary_tree program, which was put together on gedit but
opened in Vim for the asking. Vi was the original Unix editor and vim is the much improved descendant.

   
 
Work for the week-end!

No comments: