🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #371

Re: delete operator

#371
From: Greg Demichillie
Date: Tue, 14 Apr 1992 15:45
33 lines
1559 bytes
In article <1992Apr6.004508.8350@cs.mcgill.ca> storm@cs.mcgill.ca (Marc WANDSCHNEIDER) writes:
>
>
>	Does the C++ Delete operator often cause the system to hang in
>Windows 3.x programming...?  [This might be a faq, so if it is, could
>somebody point me to such a faq...]
>
>	I've been trying to make sure that I clean up after myself in
>this program I'm writing, but for some reason, when I delete one object
>(and not another of the same type), the system just hangs, and the app
>freezes up forcing a soft reboot...
>
>	Should I be using a windows memory allocation function...?
>

There is nothing magical about the delete operator regarding memory 
deallocation.  It is a user-definable function.  Many C++ implementations
just map operator new and delete to malloc and free.  You need to check
what your particular development systems does.

One problem you may be having is that you might be deleting a C++ object
that represents a Windows object (i.e., brush, pen, window etc...) and
you may end up deleting a Windows object that is currently selected into
a DC.  

Hope this helps.

-Greg
 
-- 
Greg DeMichillie
Software Design Engineer - Application Frameworks (AFX)
gregde@microsoft.com
Technical Details
Message-ID: <1992Apr14.154513.780@microsoft.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!microsoft!gregde
References: <1992Apr6.004508.8350@cs.mcgill.ca>

Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.ms.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!microsoft!gregde
From: gregde@microsoft.com (Greg Demichillie)
Subject: Re: delete operator
Message-ID: <1992Apr14.154513.780@microsoft.com>
Date: 14 Apr 92 15:45:13 GMT
Organization: Microsoft Corp.
References: <1992Apr6.004508.8350@cs.mcgill.ca>
Lines: 31