• 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: "G?ran Ehn" <email@hidden>
  • Date: Tue, 29 Apr 2003 16:58:16 +0200

Is this fault the same when using OS X or does OS X handle read command differently?
/goran


On Tue, 29 Apr 2003 07:34:36 -0700
Paul Berkowitz <email@hidden> wrote:
It's nothing to do with the script editor. That's a different limitation.
You'd get the same error running the script from an applet. It's a
limitation of the 'read' command. It's limit must be far higher than the
30,000 bytes I'm using, but I don't know what it is, and 30K always works.
Since the read command is extremely fast, breaking it into chunks this size
still doesn't take much time and is safe. I'm open to hearing from anyone as
to a higher number of bytes that's guaranteed to work 100% without error.

--
Paul Berkowitz



From: "G?ran Ehn" <email@hidden>
Date: Tue, 29 Apr 2003 16:26:35 +0200
To: Paul Berkowitz <email@hidden>, Applescript-Users
<email@hidden>
Subject: Re: Error: Stack overflow

OK, I see, I had some similair idea of splitting the file
in my head, but I thought that it must be possible to read
the whole file at once. But I guess its not possible,
right? Is this due to limitations the script editor
itself?
/goran


On Tue, 29 Apr 2003 06:53:03 -0700
Paul Berkowitz <email@hidden> wrote:
On 4/29/03 6:38 AM, "G?ran Ehn" <email@hidden>
wrote:

I'm reading a file from disk which is about 1200 lines
(52k) which is not very large in my mind. However I get
this error telling me "stack overflow" when reading
large
files, smaller files are reads ok though. Is there a way
to control memory in AS or is it just a lack in the
script
editor (1.8.3 under OS 9.2.2)? Any workarounds for this
kind of problem?

read my_xmlfile as string to eof --reads the file


set fileRef to open for access alias "file:path"
try
set r to read fileRefon error
on error
set r to my ReadPartials(fileRef)
end try

on ReadPartials(fileRef)
local b, y, r, textClump
set b to 1
set y to 30000
set r to ""
set finished to false
repeat until finished
try
set textClump to read fileRef from b to y
set r to r & textClump
on error -- last text clump
set textClump to read fileRef from b to eof
set r to r & textClump
set finished to true
end try
set {b, y} to {b + 30000, y + 30000}
end repeat
return r
end ReadPartials



--
Paul Berkowitz
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.

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

  • Prev by Date: Machine ID
  • Next by Date: Re: Swedish version AS 1.8.3?
  • Previous by thread: Re: Error: Stack overflow
  • Next by thread: Re: Error: Stack overflow
  • Index(es):
    • Date
    • Thread