{"id":15835,"date":"2020-11-24T09:12:58","date_gmt":"2020-11-24T09:12:58","guid":{"rendered":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/"},"modified":"2020-11-24T09:12:58","modified_gmt":"2020-11-24T09:12:58","slug":"review-c-memory-management","status":"publish","type":"post","link":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/","title":{"rendered":"Review C++ memory management"},"content":{"rendered":"<style type=\"text\/css\"><\/style><p>Objectives<br \/>\nReview C++ memory management, including copy constructors, destructors, and assignment operators.<br \/>\nUse Valgrind to check for memory leaks.<br \/>\nReview the procedures to access the GL servers and to compile programs on GL.<br \/>\nTo ensure that you are able to submit project files on GL.<br \/>\nIntroduction<br \/>\nIn this project, you will complete a C++ class by writing a copy constructor, destructor, and assginment operator. Furthermore, you will write a test program and use Valgrind to check that your program is free of memory leaks. Finally, you will submit your project files on GL. If you have submitted programs on GL using shared directories (instead of the submit command), then the submission steps should be familiar.<\/p>\n<p>Assignment<\/p>\n<p>Step 1: Complete the Stack class<br \/>\nThe Stack class implements a templated, linked list-based stack. Complete the class by writing the copy constructor, destructor, and assignment operator. The function prototypes are provided in stack.h. Since the class is templated, the implementation will be done entirely in stack.h; there is no stack.cpp file.<\/p>\n<p>Step 2: Test your code<br \/>\nYou must write a test program called mytest.cpp that checks correctness of the copy constructor and assignment operator. See driver.cpp for an example of how to use the stack class; output from the program is provided in driver.txt.<\/p>\n<p>Following is a list of essential tests; we refer to the stack created by the copy constructor or on the left side of the assignment operator as the new stack; the stack from which the copy is made is the source:<\/p>\n<p>Check that a copy is made. The new stack should contain exactly the same data as the source stack.<br \/>\nCheck that the copy is deep. Modifying either stack (new or source) should not affect the other.<br \/>\nCheck edge cases. For example, do they work correctly if the source stack is empty?<br \/>\nFor the assignment operator, check that you have guarded against self-assignment.<br \/>\nStep 5: Check for memory leaks<br \/>\nRun your test programs using Valgrind. For example, assuming you have compiled mytest.cpp, producting the executable mytest.out, run the command<\/p>\n<p>valgrind mytest.out<br \/>\nIf there are no memory leaks, the end of the output should be similar to the following:<\/p>\n<p>==8613==<br \/>\n==8613== HEAP SUMMARY:<br \/>\n==8613==\u00a0 \u00a0 in use at exit: 0 bytes in 0 blocks<br \/>\n==8613==\u00a0 total heap usage: 14 allocs, 14 frees, 73,888 bytes allocated<br \/>\n==8613==<br \/>\n==8613== All heap blocks were freed \u2014 no leaks are possible<br \/>\n==8613==<br \/>\n==8613== For lists of detected and suppressed errors, rerun with: -s<br \/>\n==8613== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)<br \/>\nThe important parts are in use at exit: 0 bytes and no leaks are possible. The last line is also important as memory errors can lead to leaks.<\/p>\n<p>Step 7: Submit your files<br \/>\nSee the What to Submit section, below.<\/p>\n<p>Implementation Notes<br \/>\nEach project has a section on implementation notes. These point out some issues that you might encounter while developing your code. You should look through the Implementation Notes before you start coding.<\/p>\n<p>The class declarations (Node and Stack) and provided function implementations in stack.h may not be modified in any way. No additional libraries may be used, but additional using statements are permitted.<br \/>\nThe locations for the function implementations are clearly marked in stack.h. They must be written at the specified locations; in particular, they must not be written in-line.<br \/>\nPrivate helper functions may be used, but must be declared in the private section of the Stack class. There is comment indicating where private helper fuction declarations should be written.<br \/>\nYou should read through the coding standards for this class.<br \/>\nWhat to Submit<\/p>\n<p>You must submit the following files to the proj0 submit directory:<\/p>\n<p>stack.h<br \/>\nmytest.cpp<\/p>\n<p><center><a href=\"http:\/\/onlineclassesguru.com\/orders\/ordernow\"><img decoding=\"async\" src=\"https:\/\/encrypted-tbn0.gstatic.com\/images?q=tbn:ANd9GcTyj99p60XCLyLk1htB7-1neRt8-2QdnenNlQ&usqp=CAU\"target=\"_http:\/\/onlineclassesguru.com\/orders\/ordernow\"\/><\/center><p>","protected":false},"excerpt":{"rendered":"<p>Objectives Review C++ memory management, including copy constructors, destructors, and assignment operators. Use Valgrind to check for memory leaks. Review the procedures to access the GL servers and to compile programs on GL. To ensure that you are able to submit project files on GL. Introduction In this project, you will complete a C++ class&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-15835","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Review C++ memory management - onlineclassesguru<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Review C++ memory management - onlineclassesguru\" \/>\n<meta property=\"og:description\" content=\"Objectives Review C++ memory management, including copy constructors, destructors, and assignment operators. Use Valgrind to check for memory leaks. Review the procedures to access the GL servers and to compile programs on GL. To ensure that you are able to submit project files on GL. Introduction In this project, you will complete a C++ class...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/\" \/>\n<meta property=\"og:site_name\" content=\"onlineclassesguru\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-24T09:12:58+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin_admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/onlineclassesguru.com\/#website\",\"url\":\"https:\/\/onlineclassesguru.com\/\",\"name\":\"onlineclassesguru\",\"description\":\"Cheap Professional coursework and reaction papers help\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/onlineclassesguru.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/#webpage\",\"url\":\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/\",\"name\":\"Review C++ memory management - onlineclassesguru\",\"isPartOf\":{\"@id\":\"https:\/\/onlineclassesguru.com\/#website\"},\"datePublished\":\"2020-11-24T09:12:58+00:00\",\"dateModified\":\"2020-11-24T09:12:58+00:00\",\"author\":{\"@id\":\"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742\"},\"breadcrumb\":{\"@id\":\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/onlineclassesguru.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Review C++ memory management\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742\",\"name\":\"admin_admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/onlineclassesguru.com\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g\",\"caption\":\"admin_admin\"},\"url\":\"https:\/\/onlineclassesguru.com\/index.php\/author\/admin_admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Review C++ memory management - onlineclassesguru","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/","og_locale":"en_US","og_type":"article","og_title":"Review C++ memory management - onlineclassesguru","og_description":"Objectives Review C++ memory management, including copy constructors, destructors, and assignment operators. Use Valgrind to check for memory leaks. Review the procedures to access the GL servers and to compile programs on GL. To ensure that you are able to submit project files on GL. Introduction In this project, you will complete a C++ class...","og_url":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/","og_site_name":"onlineclassesguru","article_published_time":"2020-11-24T09:12:58+00:00","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin_admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/onlineclassesguru.com\/#website","url":"https:\/\/onlineclassesguru.com\/","name":"onlineclassesguru","description":"Cheap Professional coursework and reaction papers help","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/onlineclassesguru.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/#webpage","url":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/","name":"Review C++ memory management - onlineclassesguru","isPartOf":{"@id":"https:\/\/onlineclassesguru.com\/#website"},"datePublished":"2020-11-24T09:12:58+00:00","dateModified":"2020-11-24T09:12:58+00:00","author":{"@id":"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742"},"breadcrumb":{"@id":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/onlineclassesguru.com\/index.php\/2020\/11\/24\/review-c-memory-management\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/onlineclassesguru.com\/"},{"@type":"ListItem","position":2,"name":"Review C++ memory management"}]},{"@type":"Person","@id":"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742","name":"admin_admin","image":{"@type":"ImageObject","@id":"https:\/\/onlineclassesguru.com\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g","caption":"admin_admin"},"url":"https:\/\/onlineclassesguru.com\/index.php\/author\/admin_admin\/"}]}},"_links":{"self":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/15835"}],"collection":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/comments?post=15835"}],"version-history":[{"count":0,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/15835\/revisions"}],"wp:attachment":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/media?parent=15835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/categories?post=15835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/tags?post=15835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}