One of my AppleScript is giving me memory errors:
property Mailbox0: ""
property Mailbox1: ""
property currentMessageStr: "0"
with timeout of 10000 seconds
set currentMessage to currentMessageStr as integer
tell application "Mail"
set theMessage to (message currentMessage of mailbox (Mailbox1) of
account (Mailbox0))
if not deleted status of theMessage then
return source of theMessage
end if
end tell
end timeout
2016-02-20, 16:56:42 Script Properties: Mailbox0: Bluewin
Mailbox1: INBOX
currentMessageStr: 4695
2016-02-20, 16:56:42 Dialog: An error occurred when trying to archive mails!
Error: -108
The script is executed with parameters once for each mail in the mailbox. And
then the app crashes (see below).
I've added the Autoreleasepool, but I'm wondering if I do this correctly:
dim n as new NSAutoreleasePoolMBS
'code to execute script with current position in mailbox
position = position + 1
if position mod 100 = 0 then
n = nil
n = new NSAutoreleasePoolMBS
DelayMBS 0.1
end if
The documentation at
https://www.monkeybreadsoftware.net/class-nsautoreleasepoolmbs.shtml uses the
Autoreleasepool only at the beginning and the end of the thread, correct? And
the examples don't show anything at all.
Thread 10 Crashed:
0 libsystem_platform.dylib 0x93bd10f7
_platform_memmove$VARIANT$sse42 + 39
1 com.apple.applescript 0x08b1dd8b GCFlipObject(void**, void*,
void*) + 361
2 com.apple.applescript 0x08b1ee80 GCScanStacks(TGCArea*,
TGCArea*, void*, void*) + 73
3 com.apple.applescript 0x08b1def7 GCCollect(unsigned long) +
273
4 com.apple.applescript 0x08b1db84 GCArea_AllocateTop(unsigned
long) + 62
5 com.apple.applescript 0x08b1f17c _GCMakeString(unsigned long,
unsigned char const*) + 23
6 com.apple.applescript 0x08b631c0 UASPushUnicodeText(unsigned
short const*, unsigned long) + 33
7 com.apple.applescript 0x08b63365 UASPushUnicodeText(AEDesc
const*) + 209
8 com.apple.applescript 0x08b469d8 DecodeAEDescInternal(AEDesc
const*, TUASDecodeState) + 3930
9 com.apple.applescript 0x08b47a51 DecodeAEDesc(AEDesc const*,
unsigned char) + 63
10 com.apple.applescript 0x08b5e65a
UASDecodeReply(TStackFrame_UASRemoteSend*, short, AEDesc*, unsigned char*) +
1708
11 com.apple.applescript 0x08b5e966 UASRemoteSend(unsigned char,
unsigned char, unsigned char, unsigned char, unsigned char, unsigned char*) +
643
12 com.apple.applescript 0x08b54569
UASRemoteGetData(TUASObjectAlias*, TUASApplication*, TUASClassIdentifier*,
unsigned char*) + 1022
13 com.apple.applescript 0x08b6a0d6
UASGetDataNoCircularities(unsigned char, TUASClassIdentifier*) + 146
14 com.apple.applescript 0x08b6a169 UASGetData(unsigned char,
TUASClassIdentifier*) + 65
15 com.apple.applescript 0x08b3e9ca BCGetData() + 26
16 com.apple.applescript 0x08b3ecb8 UASExecute1() + 361
17 com.apple.applescript 0x08b3eaf9 UASExecute(unsigned char) +
211
18 com.apple.applescript 0x08b08ca4 ASExecute(unsigned long,
unsigned long, long, unsigned long*) + 453
19 com.apple.CoreServices.CarbonCore 0x9dc497eb callComponent_4444 + 40
20 com.apple.CoreServices.CarbonCore 0x9dc38416 CallComponentFunction + 42
21 com.apple.applescript 0x08b04a7d AppleScriptComponent + 1791
22 com.apple.CoreServices.CarbonCore 0x9db890b5 CallComponent + 186
23 com.apple.CoreServices.CarbonCore 0x9dbb7b5a DelegateComponentCall + 24
24 com.apple.applescript 0x08b20a58
AGenericCall::Delegate(ComponentInstanceRecord*) + 50
25 com.apple.applescript 0x08b20a00
AGenericManager::HandleOSACall(ComponentParameters*) + 60
26 com.apple.applescript 0x08b1ff5b GenericComponent + 115
27 com.apple.CoreServices.CarbonCore 0x9db890b5 CallComponent + 186
28 com.apple.CoreServices.CarbonCore 0x9db88ff6 CallComponentDispatch + 29
29 com.apple.openscripting 0x9bddde59 OSAExecute + 63
30 com.apple.Foundation 0x94f06716 -[NSAppleScript(NSPrivate)
_executeWithMode:andReturnError:] + 145
31 com.apple.Foundation 0x94f06419 -[NSAppleScript
executeAndReturnError:] + 48
32 MBS_NSAppleScript_Plugin_18880.dylib 0x077eaf0e
executeAndReturnError(REALobjectStruct*, _REALdictionary*&) + 254
33 com.mothsoftware.mailarchiverx 0x0041353d
NSAppleScriptMBS.execute%o<NSAppleEventDescriptorMBS>%o<NSAppleScriptMBS>&o<Dictionary>
+ 85
34 com.mothsoftware.mailarchiverx 0x00856be8
RunAS.executeScript%%o<RunAS> + 466
35 com.mothsoftware.mailarchiverx 0x008583a1
RunAS.ExecuteScriptWithParameters%%o<RunAS>o<Dictionary> + 387
36 com.mothsoftware.mailarchiverx 0x011cc5f4
emlxIterator.nextObject%s%o<emlxIterator> + 4206
37 com.mothsoftware.mailarchiverx 0x00c96fd3
MailParser.GetHeaderOrMail%%o<MailParser>o<MailIterator> + 1103
38 com.mothsoftware.mailarchiverx 0x00c8e7f9
MailParser.parse%i4%o<MailParser> + 3167
39 com.mothsoftware.mailarchiverx 0x00c438dd
ArchiveThread.Archive%%o<ArchiveThread> + 7256
40 com.mothsoftware.mailarchiverx 0x00c3f3eb
ArchiveThread.Event_Run%%o<ArchiveThread> + 67
41 com.xojo.XojoFramework 0x01f6dd66 0x1dba000 + 1785190
42 libsystem_pthread.dylib 0x975afa26 _pthread_body + 138
43 libsystem_pthread.dylib 0x975af99c _pthread_start + 155
44 libsystem_pthread.dylib 0x975acf96 thread_start + 34
Mit freundlichen Grüßen/Regards
Trixi Willius
http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info