Brian Stevens wrote: > Joe Lertola wrote: >> >> I am guessing that the problem is caused by saving a resource too >> many times. The crash happens after calling USR ReplaceResource >> about 250 times. I have not been able to isolate where the crash >> happens with def.debugstring commands. But the crash usually seems >> to happen shortly after this line: > The text in the reference manual for Def ChangedResource is > somewhat illuminating (USR ReplaceResource calls this). USR > ReplaceResource copies the handle. Also, (just skimming) the USR > code does not call CloseResFile or UpdateResFile (CloseResFile > calls update first, so it is unnecessary in that case) but just > marks it as changed with the DEF ChangedResource calls. The > CloseResFile call releases the memory for the resource handles, so > maybe the app accumulates too many and finally crashes. Doing 250 > CloseResFiles is not my recommendation but strategically placed > might improve matters. The old resource manager calls probably > haven't changed from OS X 10.3 to 10.4, so the difference from one > machine to another is probably related to more or less memory being > available and not the OS version per se. 250 USR ReplaceResource > calls sounds excessive to me. I'd find a way to reduce this > regardless because your users will probably manipulate images > larger than those used in testing and the crash will come earlier. In OS X 10.4, a resource tends to become corrupted if more than 16 MB of changes are made without a call to UpdateResFile. I don't know if this limit is different in 10.3, or how it relates to your 250 calls (16 MB/250 ≈ 64 K). Immediately after your call pictHndl& = USR ReplaceResource( pictHndl&, _"PICT", _prevIconTemp, "tempIcon", gExternalGradientResource) add this line UpdateResFile( gExternalGradientResource ) to see if it repairs the problem. Robert P.