Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!microsoft!kensy From: kensy@microsoft.UUCP (Ken SYKES) Newsgroups: comp.windows.ms Subject: Re: Space for pens, brushes, and other objects Message-ID: <57775@microsoft.UUCP> Date: 27 Sep 90 02:33:53 GMT References: <4941@hsv3.UUCP> <4942@hsv3.UUCP> Reply-To: kensy@microsoft.UUCP (Ken SYKES) Organization: Microsoft Corp., Redmond WA Lines: 25 In article <4942@hsv3.UUCP> jls@headland.UUCP (James Seidman) writes: > >Where in memory are objects stored? I'd most like to know if they're >handled in such a way that they are automatically disposed when an application >terminates, or if they always need to be explicitly removed with >DeleteObject(). Objects are not automatically disposed of. You must explicitly delete them. Not only that, the objects *usually* reside in the local heaps of USER or GDI, depending on the object. If you don't free them up then you are restricting the memory available to other apps. When checking for memory leaks keep an eye on USER and GDI's local heap and make sure you aren't leaving anything around. > >On a similar note, do you have to use DeleteObject() to remove an object >obtained with GetStockObject()? (In fact, is it even considered valid >to do so?) >-- Apps shouldn't delete StockObjects. Ken Sykes Disclaimer: The above opinions are solely my own.