TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Phil Crown
from: Peter Fitzsimmons
date: 1996-03-12 02:20:28
subject: memory leaks

PC> Is it possible for an OS/2 app to leak memory?  I heard that when an OS/2
 PC> app is terminated that OS/2 will reclaim ALL and ANY 
 PC> memory that the app was
 PC> using.

This is generally true.  There are things to note:

 1) There is no such thing as a Workplace Shell "program";  a WPS program
    is a DLL,  so it must be particularly vigilant about cleaning up
    after itself.

 2) Anything you put in the PM clipboard,  but do not delete,  will remain
    in memory.

 3) At one time,  forgetting to delete bitmap handles and the like would
    chew up memory,  but I think all of these bugs have been tracked
    down by now.

 PC> For example, say I have a container that uses a RECORDCORE (or
 PC> MINIRECORDCORE) structure, and I don't free the icons (or possibly some
 PC> other info in the struct), would this cause a memory leak?

Anything an EXE allocates with DosAllocMem (therefore malloc() or new),will
be freed when the program ends.  

However -- if your container is ever closed and then reopened by the user, 
then your recordcore's will not have been freed -- if they do this a lot
and your program runs for a very long time,  it will chew up memory.


--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)
SEEN-BY: 50/99 78/0 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 259/414 400 99 250/99 3615/50 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.