Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93096671

Have any Question?


Related Questions in Computer Engineering

Question you are required to sort a file containing

Question : You are required to sort a file containing integers between 0 and 999999. You cannot afford to use one million pigeon-holes, so you decide instead to use one thousand pigeon-holes numbered from 0 to 999. You b ...

Describe the role of an ethical hacker and describe what

Describe the role of an ethical hacker and describe what you can do legally as an ethical hacker

The scenario is to create a program for a windows company

The scenario is to create a program for a windows company. The program should display the total amount a customer owes, given the number of windows ordered and the price per window. Total owed is calculated by multiplyin ...

If we compare and contrast the four market structures it is

If we compare and contrast the four market structures, it is evident that one market structure is most practiced and evident in the United States. It is the one that promotes and strives on competition. It is the one tha ...

We use typecasting when we want to cast a value of one type

We use typecasting when we want to cast a value of one type to a value of another type. Specifically, in this program, we want to convert a value of type double to a value of type int. Recall that Java lets you assign a ...

Run a c code to solve the following problemsuppose that you

Run a C code to solve the following problem: Suppose that you are planning to pay $14500 yearly for 4 years for a car which is $50000 now what would be the interest rate? You may follow the bellow formula: P=A((1+i)^n-1) ...

It is said the best icons are more like traffic signs than

It is said "the best icons are more like traffic signs than graphic illustrations" providing a quick indication of the task they represent. Take a look at the Ribbon and tell us how well the graphic on each of the Ribbon ...

Identify at least two 2 factors that have led to the

Identify at least two (2) factors that have led to the explosive growth of digital crime over the past a few decades. Next, describe the most common forms of digital crime, and give your opinion as to why those forms you ...

Question specify design implement im c a class for a card

Question : Specify, design implement im c++ a class for a card in a deck of playing cards. The object should contain methods for setting and retrieving the suit and rank of the card. Make sure to separate your work on s ...

Review the following scenario and complete the

Review the following scenario and complete the design. Scenario You have been asked by the Payroll department to create a program that will calculate the weekly pay for the company's 25 employees. The employee names and ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As