Bigelow et al. (2015) opined that memory management is one of the big issues in fundamental programming. Though, it’s an important aspect to manage memory in the programming environment using C++ [1]. Lakhotia, Harman and Gross (2013) stated that smart pointers are the class objects which look as well as feel like pointer, but they are smarter [2].
This report is designed to explain the use of C++ language in memory management and smart pointer in programming environment.
1. Memory Management
Consider we have numerous procedures for which we have to assign memory, if we designate memory for one process and move to second process for portion, so in what manner will you monitor last distributed memory obstruct, for this we have to store some metadata with dispensed memory square, for example, pointer focuses to a next square, memory address, is free and so on [3].
Memory administration is most likely the most concerning issue when utilising C++. Memory administration mistakes are both simple to make and hard to recognise. C++ infers three implicit memory administration issues –
In C++ we perceive three sorts of memory administration – programmed, static assignment and dynamic portion –
2. Smart Pointer
Utilising smart pointers, we can make pointers to work in way that we don’t have to call erase unequivocally. Shrewd pointer is a wrapper class over a pointer with administrator like * and – > over-burden. The objects of keen pointer class look like pointer, however, can do numerous things that a typical pointer cannot care for programmed decimation (truly, we don’t need to utilise erase expressly), reference checking and that’s just the beginning [14].
The thought is to make a class with a pointer, destructor and over-burden administrators like * and – >. Since destructor is naturally considered when a protest leaves scope, the progressively apportioned memory would consequently be erased (or reference tally can be decremented). Consider the accompanying basic smartPtr class. Smart pointers are likewise valuable in the administration of assets, for example, document handles or system attachments. C++ libraries give executions of savvy pointers as auto_ptr, unique_ptr, shared_ptr and weak_ptr [6].
Smart pointer is utilised to make more effective utilisation of accessible memory and to abbreviate distribution and deallocation time. A typical methodology for utilising memory all the more proficiently is duplicate on compose (COW) [13]. This implies a similar question is shared by many COW pointers as long as it is just perused and not changed. At the point when some piece of the program endeavours to change the protest (“compose”), the COW pointer makes another duplicate of the question and alters this duplicate rather than the first question [8]. The standard string class is usually actualised utilising COW semantics (see the <string> header).
Improved distribution plans are conceivable when you can make a few suspicions about the articles to be allotted or the working condition [9]. For instance, you may realise that every one of the articles will have a similar size, or that they will all live in a single string. Even though it is conceivable to execute improved designation plans utilising class-particular new and erase administrators, brilliant pointers give you the opportunity to pick whether to utilise the upgraded plan for each protest, rather than having the plan set for all objects of a class [10]. It is subsequently conceivable to coordinate the portion plan to various working conditions and applications, without altering the code for the whole class.
The C++ standard library incorporates an arrangement of holders and calculations known as the standard layout library (STL). STL is intended to be conventional (can be utilised with any protest) and proficient (does not acquire time overhead contrasted with options) [11]. To accomplish these two plan objectives, STL holders store their items by esteem. This implies if you have an STL compartment that stores objects of class Base, it can’t store of objects of classes got from Base.
Conclusion
It is noticed that programming of memory management using C++ is more powerful that gives full control over the entire memory management process. However, it is also identified that lack of automatic memory mechanism exposed by C++ may result in the memory leak and dangling pointer.
References
[1] D. Bigelow, T. Hobson, R. Rudd, W. Streilein, and H. Okhravi, “Timely Rerandomization for Mitigating Memory Disclosures,” in The 22nd ACM SIGSAC Conference on Computer and Communications Security (CCS2015), 2015.
[2] K. Lakhotia, M. Harman, and H. Gross, “AUSTIN: An open source tool for search-based software testing of C programs,” in Information and Software Technology, 2013.
[3] K. Anand et al., “A compiler-level intermediate representation based binary analysis and rewriting system,” in Proceedings of the 8th ACM European Conference on Computer Systems – EuroSys ’13, 2013.
[4] S. Nagarakatte and M. Zdancewic, “WatchdogLite: Hardware-Accelerated Compiler-Based Pointer Checking,” Cgo, 2014.
[5] G. J. Duck and R. H. C. Yap, “Heap bounds protection with low-fat pointers,” in CC 2016: Proceedings of the 25th International Conference on Compiler Construction, 2016.
[6] T. C. Stewart, F.-X. Choo, and C. Eliasmith, “Spaun: A Perception-Cognition-Action Model Using Spiking Neurons,” Proc. 34th Annu. Meet. Cogn. Sci. Soc. CogSci 2012, 2012.
[7] M. C. Rodriguez-Sanchez and J. Martinez-Romo, “GAWA – Manager for accessibility Wayfinding apps,” Int. J. Inf. Manage., 2017.
[8] J. Qiu et al., “Going Deeper with Embedded FPGA Platform for Convolutional Neural Network,” in Proceedings of the 2016 ACM/SIGDA International Symposium on Field-Programmable Gate Arrays – FPGA ’16, 2016.
[9] A. Sivieri, L. Mottola, and G. Cugola, “Building Internet of Things software with ELIoT,” Comput. Commun., 2016.
[10] Y. Sui, D. Ye, and J. Xue, “Static memory leak detection using full-sparse value-flow analysis,” in Proceedings of the 2012 International Symposium on Software Testing and Analysis – ISSTA 2012, 2012.
[11] F. Winterstein, S. Bayliss, and G. A. Constantinides, “High-level synthesis of dynamic data structures: A case study using Vivado HLS,” in FPT 2013 – Proceedings of the 2013 International Conference on Field Programmable Technology, 2013.
[12] F. J. Winterstein, S. R. Bayliss, and G. A. Constantinides, “Separation Logic for High-Level Synthesis,” ACM Trans. Reconfigurable Technol. Syst., 2015.
[13] G. Weisz, J. Melber, Y. Wang, K. Fleming, E. Nurvitadhi, and J. C. Hoe, “A Study of Pointer-Chasing Performance on Shared-Memory Processor-FPGA Systems,” in Proceedings of the 2016 ACM/SIGDA International Symposium on Field-Programmable Gate Arrays – FPGA ’16, 2016.
[14] S. Ullrich, Y. C. de Vries, S. Kühn, D. Repantis, M. Dresler, and K. Ohla, “Feeling smart: Effects of caffeine and glucose on cognition, mood and self-judgment,” Physiol. Behav., 2015.
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Contact Essay is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Essay Writing Service Works
First, you will need to complete an order form. It's not difficult but, in case there is anything you find not to be clear, you may always call us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order formOnce we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignmentAs soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download