[comp.sys.mac.programmer] SuperCard problem

hsu_wh@jhunix.HCF.JHU.EDU (William H Hsu) (05/12/91)

	I have written a SuperCard stack which contains about 7 windows and
is very densely filled with digitized color and grayscale graphics and ASCII
text.  In one of the windows (actually in a card background) I wrote a multi-
window search routine which uses "Find" as its basic command (inside a loop).
	The arguments to the "Find" are:

		- a string to be searched for
		- a window to open (originally a stack before proting to SC
					v 1.5)
		- the field to be searched for, usually something like:
			bg fld "Report Window" of wd theWindow
	I am getting a crash during searches for certain words (e.g.,
"striate cortex") which causes the Mac (I've tried this on a 2.5 Mb SE, a
5 Mb IIcx, and an 8 Mb IIcx) to freeze up completely.  Other words (e.g.,
"positron") work fine.  Different words seem to crash on different windows;
however, the only two cases in which I have been able to recreate the bomb
occurred when the window (i.e., the field) was blank -- all cards were
devoid of text.  Putting in some didn't help.
	If anyone can tell what is wrong at this point, I would greatly
appreciate it.  I would certainly be willing to mail any or all of the code
to whomever might care to take a look, but it is far to long to post even
partially.  SuperCard technical support has told me the following:

1) It may be a memory fragmentation error caused by having windows opened
and closed frequently.
	I know that it can't be having too many windows open, because I
tried closing windows as soon as they have been searched.  A suggestion was
that I use the hasMemory function, but I can't figure it out.
2) Do not use the message box for the command; use "do".
	Originally, I was putting commands into the message box and using "type
return".  This seemed unwieldy, so I switched at the recommendation of SC's
programmers.  However, there seems to be no difference.  The "Do
Command" still sends a system message (I ascertained via 'trace' that it was
crashing right after a system message.

	Any suggestions would be very much appreciated.  I can be reached at:

	hsu@cs.jhu.edu
	hsu_wh@jhuvms.hcf.jhu.edu

						- William Hsu