lecture 37: real-world use of graphs

Download Lecture 37: Real-World USE OF Graphs

Post on 14-Feb-2016

19 views

Category:

Documents

0 download

Embed Size (px)

DESCRIPTION

CSC 213 – Large Scale Programming. Lecture 37: Real-World USE OF Graphs. Today’s Goals. Consider what new does & how Java works What are traditional means of managing memory? Why did they change how this was done for Java? What are the benefits & costs of these changes? - PowerPoint PPT Presentation

TRANSCRIPT

Memory Management

Lecture 37:Real-World USE OF GraphsCSC 213 Large Scale Programming

#Todays GoalsConsider what new does & how Java worksWhat are traditional means of managing memory?Why did they change how this was done for Java?What are the benefits & costs of these changes?Examine real-world use of graphs & its benefitsHow do all of those graph algorithms get used?Can we take advantage of this knowledge somehow?What occurs in real-world we have not covered?And why is beer ALWAYS answer to lifes problemsExplicit Memory ManagementTraditional form of memory managementUsed a lot, but fallen out of favormalloc / newCommands used to allocate space for an objectfree / deleteReturn memory to system using these command

Simple to use#Explicit Memory ManagementTraditional form of memory managementUsed a lot, but fallen out of favormalloc / newCommands used to allocate space for an objectfree / deleteReturn memory to system using these command

Simple to use, but tricky to get rightForget to free memory leakfree too soon dangling pointer#Dangling PointersNode x = new Node(happy);#Dangling PointersNode x = new Node(happy);Node ptr = x;#Dangling PointersNode x = new Node(happy);Node ptr = x;delete x; // But Im not dead yet!

#Dangling PointersNode x = new Node(happy);Node ptr = x;delete x; // But Im not dead yet!Node y = new Node(sad);#Dangling PointersNode x = new Node(happy);Node ptr = x;delete x; // But Im not dead yet!Node y = new Node(sad);cout

Recommended

View more >