• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Error: Stack overflow
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error: Stack overflow


  • Subject: Re: Error: Stack overflow
  • From: Christopher Nebel <email@hidden>
  • Date: Wed, 30 Apr 2003 11:11:33 -0700

On Wednesday, April 30, 2003, at 08:27 AM, Paul Berkowitz wrote:

On 4/30/03 1:02 AM, "Shane Stanley" <email@hidden> wrote:

On 30/4/03 5:08 PM +1000, Paul Berkowitz, email@hidden, wrote:

Before John ever answered, I supplied an equivalent script that would not fail on short chunks. It has been ignored here

Well I only ignored it in so far as I was pointing out that in the case in
question it was probably addressing the wrong problem. But if you consider your script, although you're reading in separate chunks, you're still putting everything into one variable. Do that enough times and _that_ will cause a memory error too (although it will probably take a much bigger file to do it).

I'm sure you're right, although I haven't hit that problem yet. That may be
the 1 GB limitation Chris N. referred to - the limit for string length in a
variable.

Actually, the entire AppleScript heap -- that is, all your variables together, plus some miscellaneous housekeeping stuff -- is limited to 1GB, so trying to manipulate a hundreds-of-MB string could make you hit that without too much difficulty. That's not the problem here though, since that will cause an "out of memory" error.

Like I said offline, I'm thoroughly unconvinced that Goran's "stack overflow" error has anything directly to do with "read", because "read" can't return that error. It's coming from somewhere inside AppleScript, and I'd like to know why, but since I can't reproduce the failure at all, that's hard to figure out.

It irritates me when people blithely assert things like "'read' can't read more than 32K at once" and then throw out a complicated handler to "fix" the problem, when a simple experiment shows that isn't true at least some of the time, and therefore you're just avoiding the real problem without understanding what it is.

That said, if you want a single routine that works even with classic Mac OS's rather primitive memory management, something like yours or JD's chunky-reading is the way to go.


--Chris Nebel
Apple Development Tools
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Error: Stack overflow (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Creating a Progress Bar, is it possible?
  • Next by Date: Re: Error: Stack overflow
  • Previous by thread: Re: Error: Stack overflow
  • Next by thread: Re: Error: Stack overflow
  • Index(es):
    • Date
    • Thread