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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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