Give a scenario that can cause lost heap-dynamic variables

Assignment Help Computer Engineering
Reference no: EM132109202

Programs written in a language that supports pointers and dynamic memory allocation can suffer from dangling pointers and lost heap-dynamic variables (or garbages).

(a) A dangling pointer is a pointer that contains the address of a piece of memory that no longer belongs to the program. Give one scenario that can cause dangling pointers.

Support your scenario with sample codes in your favorite language. Poorly implemented languages leave the detection of the dangling pointer problem to the operating system. Suggest a language implementation method to allow run-time detection of dangling pointers by the language.

(b) A lost heap-dynamic variable (or garbage) is an allocated heap-dynamic variable that is no longer accessible to the user program, although it still belongs to the program. Give a scenario that can cause lost heap-dynamic variables. Support your scenario with sample codes in your favorite language.

The reference counter method is a way to detect garbages and reclaim the storage incrementally as soon as garbages are created. It works by maintaining in every cell a counter that stores the number of pointers that are currently pointing at the cell. Embedded in the decrement operation for the reference counters, which occurs when a pointer is disconnected from the cell, is a check for a zero value.

If the reference counter reaches zero, it means that no program pointers are pointing at the cell, and the cell has thus become garbage and can be returned to the list of available space. Give three distinct disadvantages/problems with the reference counter method.

Reference no: EM132109202

Questions Cloud

Create an sql or access database with all your friends : Create an SQL or Access database with all your friends' information and write a program to load the names in the combo box and also search the database.
Summarize the recommended instructional strategies : Summarize and explain how you plan to involve Marias parents in meeting her goals. Include a specific at-home activity to help in her continued success
Write a public static method named static long : Write a public static method named static long fibFast(int n, long a, long b) that returns the nth fibonacci number.
What techniques are used for face detection : Face detection and recognition is a classical AI topic. It can be used in a variety of applications that identifies human faces in digital images or videos.
Give a scenario that can cause lost heap-dynamic variables : Give a scenario that can cause lost heap-dynamic variables. Support your scenario with sample codes in your favorite language.
Explore the different methods of calculating subnets : Research some of the options these various methods provide, and create your own "cheat sheet" to help pre-pare you for subnetting on the CompTIA Networkþ exam.
Design and develop an app for australian rent a car office : Android App Development - design and develop an App for Australian rent a car office - design and develop an App for Australian rent a car office
Display how many of each denomination would be needed : Write a C++ program that prompts the user for a cash value and an amount of purchases made against that amount.
Compute the acceleration of gravity for a given distance : Compute the acceleration of gravity for a given distance from the earth's center, dist_center, assigning the result to accel_gravity.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Examine the model performance on the validation set

Examine the model performance on the validation set. What is the accuracy rate? Is one type of misclassification more likely than the other?

  Compute and plot the frequency response magnitude

Generate and plot the first 150 points of the impulse response of the IIR filter. Compute and plot its frequency response magnitude and its group delay.

  In-house development of software

Discuss the innovative and creative ways in order to use patient ID bracelet consisting of a bar-code representation of patient's ID.

  Make use of a for loop to step through all 32 bits

The bitwise-manipulation operators perform simultaneous bit manipulations and enable programs to process large quantities of binary information well.

  Discuss the relative merits and effects on instruction cycle

Discuss the relative merits and effects on the instruction cycle implementation of the following parameter-passing techniques.

  Flowcharts and pseudo-code are two language-independent

flowcharts and pseudo-code are two language-independent ways to capture the programming steps needed to solve a

  What are ethical issue involved with downloading source code

What are the ethical issues involved with downloading the source code and replacing your name and information on the page and using it on your home page?

  Compute the total resistance in a circuit

A program is needed to calculate the total resistance in a circuit. The resistors can either be in series or in parallel but not both. The number of resistors in the circuit can range from 2 to 10. How do I get started?

  Show the schematic diagram of memory system

In each of the designs in Problem, show the physical location of the following addresses: 0, 48, 356, and 8192.

  What is the buffer explain briefly

Assume that ASC memory is built using eight interleaved blocks of 8 Kwords each. Include an instruction buffer eight words long into the ASC control unit.

  Design three layer architecture

CMPT 270 Assignment - Three Layer Architecture. In this assignment you are to design your 3-layer architecture. The third layer is the model (data) layer

  Create a menu program for the user to test your buffer

Create a menu program for the user to test your buffer and to create a palindrome. For queue, prompt the user to enter two chances and total number of rounds.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd