On Dec 20, 2006, at 10:12 PM, Brian Stevens wrote: > > 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. > > Only seeing one line of your code this is the best I can do. > > Brian S. Thanks Brian, I think I will try closing and reopening the resource file periodically and see if that helps. I could change my slider control so it does not update dynamically. Then the number of times the resource would be replaced would become small, but I would hate to give that up. It is nice the way the colors in the preview change as the sliders are moved back and forth. I wish I had asked this question two days ago. I am off for Christmas so I don't have access to my work computer until next week. On Dec 21, 2006, at 12:54 AM, Robert Purves wrote: > > 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. I think I did try calling UpdateResFile and it did not help. Maybe CloseResFile will do the trick. -Joe