[comp.sys.mac.programmer] Alerts sucking up memory?

jong@k.gp.cs.cmu.edu (Jon Gotow) (10/15/89)

I've got a cdev I've been working on that's exhibiting a strange problem.  
When certain error conditions occur, I put up an alert box using StopAlert().
Big deal, right?  Well, I seem to be losing about 8K of memory every time
I do this, based on observations I made with MemoryEater (if you're not 
familiar with it, Memory Eater is a program that simply allocates memory
and displays how much is left - it's useful for testing DA's and cdev's for
correct behavior in low memory conditions).

I'm exiting correctly from the code where the error occurs - ie. I'm not
leaving any of my data structures allocated when I shouldn't.  Is there 
something I'm missing?  All my error function does is call ParamText and
StopAlert.  Any pointers would be greatly appreciated!

If it's not something immediately obvious, I'll follow up with actual code.

				Thanks in advance,
					Jon Gotow
					jong@k.gp.cs.cmu.edu

ech@cbnewsk.ATT.COM (ned.horvath) (10/17/89)

From article <6525@pt.cs.cmu.edu>, by jong@k.gp.cs.cmu.edu (Jon Gotow):
> When certain error conditions occur, I put up an alert box using StopAlert().
> Big deal, right?  Well, I seem to be losing about 8K of memory every time
> I do this...

Have you installed a color icon (cicn), in your System File or application
for the "hand" icon (the one displayed by StopAlert)?  There is
a bug in the Dialog Manager that causes it to use PlotCIcon incorrectly and
leave an 8K of unreferenced memory in the heap.

I reported this one to MacDTS over a year ago, but haven't gone back to see
if it's been fixed in 6.0.x (it's never appeared in any "Fixed Bugs" list
I've seen).  If someone at MacDTS wants to follow up, Paul Mercer responded
to my original mail message, acknowledging that he'd reproduced the bug...

Meantime the workarounds are obvious: use plain Alert(), or rip the
cicn out.

=Ned Horvath=

jong@k.gp.cs.cmu.edu (Jon Gotow) (10/19/89)

In my response to my plea for help in figuring out why my alerts were 
sucking up 8K of memory every time I put one up, Ned Horvath replied
in article (10240@cbnewsk.ATT.COM>:

>Have you installed a color icon (cicn), in your System File or application
>for the "hand" icon (the one displayed by StopAlert)?  There is
>a bug in the Dialog Manager that causes it to use PlotCIcon incorrectly and
>leave an 8K of unreferenced memory in the heap.
>
>I reported this one to MacDTS over a year ago, but haven't gone back to see
>if it's been fixed in 6.0.x (it's never appeared in any "Fixed Bugs" list
>I've seen).  If someone at MacDTS wants to follow up, Paul Mercer responded
>to my original mail message, acknowledging that he'd reproduced the bug...
>
>Meantime the workarounds are obvious: use plain Alert(), or rip the
>cicn out.
>
>=Ned Horvath=

Thanks Ned!  I'm glad to know that this wasn't my fault (for once).  Now how
'bout it Apple?!?  Ned says he submitted this bug over a year ago, but it
still happens in 6.0.3!  I've got 5 meg of memory in my machine, so I
can afford to lose 8K now and then, but what about the rest of the world
(and the Mac I use at work)??  It seems like a small enough problem that
the fix can't be that bad.

				Jon Gotow (jong@k.gp.cs.cmu.edu)
				Research Engineer
				Carnegie-Mellon University

Disclaimer:  My opinions are purely my own.  CMU seldom recognizes that I
even have an opinion.