Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 24th, 2018, 11:38 AM
Registered User
 
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?
 
Old October 24th, 2018, 02:03 PM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
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!)





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 09:41 PM
Page 352 (Chapter 11) IDisposable Problem sosborne BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 August 18th, 2006 05: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 02:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.