=========================================== CPW Part 11: Region-based Memory Management [TOC] =========================================== ---- VIDEO ------------------------------ https://www.youtube.com/embed/kfqkgFrfxb8 ----------------------------------------- Quiz 24 ======= Implement the module for memory management as shown in the video. If you find bugs fix them ;-) Make sure that the memory managed by the module will be freed before programs using the module terminate if they follow the convention that before termination _finalize()_ gets called. Use the module for the calculator: - Remove debugging output from the region-based memory management (or only produce debug information if some special macro is defined). - Constructors for types _struct Expr_ should allocate memory with _allocFromMemRegion()_. - Remove the destructor _deleteExpr()_ from the module for expression nodes. - Add a function _deleteAllExpr()_ that releases all memory allocated for expression nodes. - Make sure that there are no memory leaks in the calculator. Validate this with _valgrind_. - In the __lcc__ compiler the parameter corresponding to our enum constant for _extra capacity_ is 10K ($10 * 1024$). For the quiz leave it a 64. It makes it easier to write tests this way. :links: lcc -> https://en.wikipedia.org/wiki/LCC_(compiler) How to Submit ------------- You have to submit a __tarball__ _quiz24.tgz_ of your project. In your project directory do the following: - Run _make clean_ - Create the tarball with ---- CODE (type=txt) ----------------------------------------------------------- tar cfvz quiz24.tgz * -------------------------------------------------------------------------------- - On _theon_ you can submit the tarball with _submit hpc quiz24 quiz24.tgz_ :links: tarball -> https://en.wikipedia.org/wiki/Tar_(computing)