Re: Severe ASOC runtime bug
Re: Severe ASOC runtime bug
- Subject: Re: Severe ASOC runtime bug
- From: Dave <email@hidden>
- Date: Fri, 21 Jan 2011 09:43:53 -0600
On Jan 21, 2011, at 4:02 AM, email@hidden wrote:
> I don't know that you can assume that memory will not become exhausted in your loop.
I'm not assuming it, I've proved it by investigating how much memory each instance takes. For 5,000 items the real memory use for that test application is 18MB. Obviously, 10,000 items should take no more than 36 MB, not 1.1GB plus.
> I don't know the strategy for memory scavenging in ASObjc or if or how it differs from AS.
I was hoping ASOC could internally use the standard Mac OS GC for AppleScript items, which appears to be excellent in my experience. But, perhaps they can't since an ASOC programmer can code or link with code that uses and relies on reference counting.
AppleScript has been using an extremely poor GC. Originally Mac OS 9's MRJ was just as bad until I pointed out to that team they were starving its GC by not letting it have more free memory. Once a Java program allocated enough data structures it would spent 98% of its time in GC instead of doing real work. After they gave the GC more free memory breathing room my Java application ran 23 times faster. I have to wonder if AppleScript's GC doesn't have the same starving problem. In a trivial script running in Script Editor my 1.5 GHz processor takes 3 seconds to examine the strings in a 250 item list. Something is very wrong about that. A 20 Megahertz M68000 running in a 32MB Mac took about 20 seconds to do the same thing.
> To investigate the problem I would:
>
> 1. try running the allocation loop in another method to applicationDidFinishLaunching_ : use a delayed selector.
> 2. what occurs if setString_ becomes setInt_ and the integer is saved rather than the coerced string
> 3. define a NSMutableDictionary property and use a timer to allocate the AsObjC objects incrementally (say 1000 at a time).
> 4. try running the collector manually - see NSGarbageCollector
> 5. use Shark and Instruments
I've already done several of these good suggestions. I've spent many hours testing and creating simple test cases that cause the run-time errors plaguing my application. In my opinion, I've seen this problem enough times that I think it will always occur once you allocate enough script instance, so trying to bypass it is a waste of time.
-- dave _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden