Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2012/5.0 > BOOK: MCSD Certification Toolkit (Exam 70-483): Programming in C#
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: MCSD Certification Toolkit (Exam 70-483): Programming in C#
This is the forum to discuss the Wrox book MCSD Certification Toolkit (Exam 70-483): Programming in C# by Tiberiu Covaci, Rod Stephens, Vincent Varallo, Gerry O'Brien; ISBN: 978-1-118-61209-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: MCSD Certification Toolkit (Exam 70-483): Programming in C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 24th, 2018, 12:38 PM
Registered User
Points: 10, Level: 1
Points: 10, Level: 1 Points: 10, Level: 1 Points: 10, Level: 1
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Oct 2018
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Clarification on IDisposable interface and memory loss

In the section on the IDisposable interface on page 191, there is a line...

If an ImageTransformer object is destroyed without using other API calls to free those handles, their memory is lost.

Is the memory only lost until the program ends or is it lost until a reboot? Is this what is known as a memory leak?
Reply With Quote
  #2 (permalink)  
Old October 24th, 2018, 03:03 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,187, Level: 23
Points: 3,187, Level: 23 Points: 3,187, Level: 23 Points: 3,187, Level: 23
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jan 2006
Location: , , .
Posts: 646
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Yes, this is an example of a memory leak.

Unfortunately, the exact behavior depends on the kind of resource that is leaking. Some objects (I think including some graphics objects) are limited on a system-wide basis, so if the program uses them all up, other programs will also suffer. That may cause weird behavior for this program and others.

I think that these sorts of leaks usually recover after the leaking program ends, but there are cases where the system could be left in a strange state. The most common example is when a program dies but leaves a file locked.

Some leaks can also mess up the system badly enough that it's hard to kill the leaking program.

The moral is, if you're using unmanaged resources, you should test with a lot of allocations and deallocations to see if there is a leak before you release the program into the wild.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Loss DPI_Web ASP.NET 3.5 Professionals 0 March 11th, 2010 10:27 AM
possible loss of precision hobby Java Basics 7 September 19th, 2008 10:41 PM
Page 352 (Chapter 11) IDisposable Problem sosborne BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 August 18th, 2006 06:12 PM
Chapter 6 IDisposable example code ahanshew BOOK: Professional VB 2005 ISBN: 0-7645-7536-8 0 February 24th, 2006 12:15 AM
I'm at a loss with IIS 5.1... wrofox Classic ASP Basics 0 September 19th, 2004 03:19 PM



All times are GMT -4. The time now is 12:36 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.