Applescript Image Events appears to have memory leak (or I don't know what I am doing)

Using Image Events to create images and thumbnails for a website. The following code results in very large memory leaks in Image Event process. I have documented results of test runs in the comments.
The leak (or poor coding on my part) results in a total system halt if I attempt to process more than about 400 images at a time. Basically, I run out ot physical memory. I am running a new model 13" MBP with 8GM RAM.  I have to manually stop Image Events to reclaim the memory (or reboot of course).
Any help/suggestions would be appreciated.
(* test memory leak in Image Events *)
          tests with 58 photos selected in iPhoto
          5.7 MB left in Image Events after run with only open and close
          22.0 MB left in Image Events after run with open, save and close
          45.9 MB left in Image Events after run with open, scale, save and close
          A run with 382 photos selected used OVER 3.8 GB (gigabytes) and the
          mac ran out of physical memory so I had to stop the test.
tell application "Finder"
          set imageFolder to folder "test" of home as alias
end tell
tell application "iPhoto"
          set currPhotoList to the selection
          repeat with currPhoto in currPhotoList
                    log name of currPhoto as string
                    set theImagePath to image path of currPhoto
                    tell application "Image Events"
  launch
                              set theImage to open theImagePath
  scale theImage to size 128
  save theImage in imageFolder as JPEG with icon
  close theImage
                    end tell
          end repeat
end tell
--- end of code example

Does the following code do any difference? Most likely no I guess… but better try than nothing.
tell application "Finder"
    set imageFolder to folder "test" of home as text -- instead of “as alias” (see theTargetPath below)
end tell
set theImagePaths to {}
set theImagePathsRef to a reference to theImagePaths -- faster with big lists
tell application "iPhoto"
    set currPhotoList to the selection
    repeat with currPhoto in currPhotoList
        log name of currPhoto as string
        get POSIX file (image path of currPhoto) as alias -- faster ?
        copy result to the end of theImagePathsRef
    end repeat
end tell
tell application "Image Events"
    launch
    repeat with theImagePath in theImagePaths
        set theImage to open theImagePath
        scale theImage to size 128
        set theTargetPath to (imageFolder & name of theImagePath)
        save theImage in theTargetPath as JPEG with icon
        close theImage
    end repeat
end tell

Similar Messages

  • I just bought and iMac and have lion installed. I'm trying to use interactive graphs at yahoo finance. Nothing shows on the screen. I assume I have to download something but don't know what or where.

    I just bought and iMac and have lion installed. I'm trying to use interactive graphs at yahoo finance. Nothing shows on the screen. I assume I have to download something but don't know what or where.

    WhyWontThisWork:
    I can definitely how frustrating it must be to not be able to take pictures or even view pictures that have already been taken with your LG Dare.
    Since this problem has started, have you tried to either:
    a.) put that memory card in an alternate phone to see if the pictures can be viewed on there
    b.) use a card reader/adapter in a computer to see if the pictures can be viewed on the computer
    c.) take the memory card out of the phone and then try to take a picture?
    What I am trying to determine is which of the 2 is defective (phone or memory card)
    If you are able to view pictures in another phone, or on the computer , then you may have a bad card. If that is the case, you can transfer the pictures to the computer and then format the memory card by
    Note: This procedure will erase all data on the memory card. It is recommended to back up the data.
    From the home screen, touch the menu tab.
    Touch Settings.
    Touch SD card & phone storage.
    Touch Unmount SD card.
    Touch Format SD card.
    Once you have done the formatting, try to take pictures again. If you continue to have problems it more than likely is the phone.
    Also, in order to access PixPlace, log into your MyVerizon account, at the top, you should see "Messaging" go down to "Manage your photo albums" once there, you should see "My Media", however, if you have already received a message advising you that your album would be deleted if you haven't logged on in more than 180 days, all pictures have then most definitely been deleted. Again, we do send warning messages once the online album hasn't been accessed in 150, 175, 180 days respectively prior to deletion.

  • HT1476 I have a big problem in my phone charger . I have Iphone 5s . I don't know what is the problem but the bettery is not working true . A decrease in the battery very quickly and then turns off the machine . Please, I want to address this problem quic

    I have a big problem in my phone charger . I have Iphone 5s . I don't know what is the problem but the bettery is not working true . A decrease in the battery very quickly and then turns off the machine . Please, I want to address this problem quickly .

    http://osxdaily.com/2013/09/19/ios-7-battery-life-fix/

  • TS3988 My credit card was charged about $100 for 8 different transactions.  Five were for 9.90.  These dates are Aug. 6, 7, 28 and 29.  I have not ordered anything and don't know what they are for.

    My credit card was charged about $100 for 8 different transactions.  Five amounts were $9.90.  These dates are Aug 6, 7, 28 and 29.  I have not ordered anything and don't know what they are for.  Please help me.  Linda Feddersen

    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBooks Store purchase
    Linda.. if you have not done so, contact your credit card company so they can monitor your account.
    And change your Apple ID password ASAP >  Apple ID: Changing your password

  • I have a big problem, I don't know what I touched but when I open up my iTunes I can't see all the icons. The only icons showing are "podcast, iTunes U and Downloads" so in other words I can't find the movies, music etc. Which means I can't buy/rent!

    I have a big problem, I don't know what I touched but when I open up my iTunes I can't see all the icons. The only icons showing are "podcast, iTunes U and Downloads" so in other words I can't find the movies, music etc. Which means I can't buy/rent!

    Not all content types are available in all countries - in each country Apple can only sell what they are licensed to (and in some cases what a country's laws allows them to). A list of what is available where is shown on this page : http://support.apple.com/kb/TS3599
    Do you have access to other music and film purchase download sites ?

  • HT1689 I Ipod says Ipod disabled please connect to Itunes.  I have connected but now I don't know what to do?

    My Ipod says disabld please connect to Itunes.  I have connected but now I don't know what to do from here?  I can't even unlock my phone.

    Disabled
    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                         
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: Back up and restore your iOS device with iCloud or iTunes
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        
    If problem what happens or does not happen and when in the instructions? When you successfully get the iPod in recovery mode and connect to computer iTunes should say it found an iPod in recovery mode.

  • HT204053 Ugh.  How do I get iCloud on my iPhone?  I have been using my iPhone for about a year and I have an iCloud account but it is useless since nothing syncs to nothing else.  Obviously I don't know what I am doing.

    Ugh.  How do I get iCloud on my iPhone?  I have been using my iPhone for about a year and I have an iCloud account but it is useless since nothing syncs to nothing else.  Obviously I don't know what I am doing.

    Welcome to the Apple community.
    Have you logged into your iCloud yet on your phone, in settings > iCloud.

  • I have a question. I don't know what happened, but my safari went from regular safari with google and now everything is yahoo. maybe it was firefox or something. I just want the regular safari back. Can someone help me?

    Frustrated!!!!!!,
    I have a question. I don't know what happened, but my safari went from regular safari with google and now everything is yahoo. maybe it was firefox or something. I just want the regular safari back. Can someone help me?

    Check the links below for options to remove the Adware.
    The Easy, safe, effective method:
    http://www.adwaremedic.com/index.php
    If you are comfortable doing manual file removals use the somewhat more difficult method:
    http://support.apple.com/en-us/HT203987
    Also read the articles below to be more prepared for the next time there is an issue on your computer.
    https://discussions.apple.com/docs/DOC-7471
    https://discussions.apple.com/docs/DOC-8071

  • Macbook Pro, accidentally uninstalled airport card somehow. Reinstalled OS and everythng, appears to be software issue, but I don't know what to do.

    Dad's Macbook Pro (10.6.3, from 2010) had perfect wifi, he accidentally uninstalled(?) it somehow, has no idea how he did it.
    It said "no airport card installed" when I'd click the little wifi icon on the bar, or go into network settings.
    I have wiped hard drive, reinstalled OS, reset SMC and PRAM, to no avail, and now there is no wifi icon at all.
    I ran a hardware test (both regular and extensive), and nothing is coming up.
    It's like the computer just CAN'T use wifi- I can't select it from any menu, for example:
    -in the main "Network" window (under System Pref) it shows only Ethernet and Firewire on the side bar
    -when I select the "+" to add a service/interface, only Firewire, Ethernet, Bluetooth DUN, VPN, 6 to 4 and PPPoE appear
    -in "Network Setup Assistant" only DSL modem, cable modem, LAN are choices. "AirPort" is there, but is grayed out and cannot be selected.
    Airport Untility is still installed, and will open but says unable to find any devices.
    And when I ran System Profiler, under Network > AirPort, I have the following
    "Software Versions:
         Menu Extra: 6.2.1
         Configd plug in: 6.2
         System Profiler: 6.0
         Network Preference: 6.2.1
         AirPort Utility: 5.4.2
         IO80211 Family: 3.1"
    I simply don't know what to do.  At first I thought I might need a physical "card" replaced, but hardware test says everything is fine, so I feel it must be software, but I wouldn't know what to try besides what I've already tried- I thought reinstalling the OS would do the trick, honestly, but it hasn't. Please help.

    System profiler certainly does suppy information of installed hardware. Not sure why you said it doesn't.
    If there is no wifi card found in the syetem then the info I outlined would be there.

  • Cannot get Shuffle to be recognized by pc. Have went through asst. 5 times. Don't know what I am doing wrong.

    Cannot get Shuffle to be recognized by pc. Have went through asst. 5 times, don't know what to do now!!

    If this is a new shuffle, make sure the plug on the USB cable is completely inserted into the shuffle's headphones jack, as shown in this document
    http://support.apple.com/kb/ts3572
    If it is properly connected, does the shuffle's light come ON at all, when you connect it to USB?  If it does, what does it do immediately after connection?

  • When trying to transfer book thru overdrive media console it says the selected portable player could not be found. Have set to manually manage don't know what to do

    I don't know if I already asked the question so here I go again. I have previously downloaded public library audiobooks thru overdrive media console successfully hundreds of times on old ipod touch.  I just got another Ipod touch and I must have pushed wrong button somewhere because when I try to transfer the title from overdrive media to ipod a box pops up saying...
    The selected portable player (ipod) could not be found.  I have set my new ipod to manually manage music and videos which is required.  Don't know what to do at my wits end.  Went to local apple store but they couldn't help me because third party is involved please help before I hurt someone lol
    I have downloaded all available update ie media player, overdrive media, itunes 

    Hi boonstra,
    Welcome to the Support Communities!
    The article below may be able to help you with this issue.
    Click on the link to see more details and screenshots. 
    iTunes: Finding lost media and downloads
    http://support.apple.com/kb/ts1408
    Cheers,
    - Judy

  • I have gecko default plugin and don't know what it is. Do I need this or should I disable it?

    I was looking at my add ins and wanting to check something called Public Fox, when I saw that I have a gecko default plugin and don't know what that is. I guess it happend with the most recent security update. So I want to know what it is and do I need it.

    We are fellow users here on these forums, you're not talking to iTunes Support nor Apple.
    You can view the purchase history on your account : if you log into your account on your computer's iTunes via the Store > View Account menu option, you should then see a Purchase History section with a 'see all' link to the right of it. Click on that and you should then see a list of your purchases (the most recent is above the list).
    If you don't recognise the charge (and nobody else has access to your account or devices and may have made it) then you can try contacting iTunes Support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • HT1567 I am connected to the internet, but itunes will not connect, it does stated that I have downloaded and installedl, I don't know what to do.  Please help.

    I downloaded and installed itunes, but itunes will not connect to ;internet (I do have internet.  I don't know what too do, can you help?

    I'm having the exact same issue. I'm connected to the VPN, but I can't mount or otherwise connect to the shared drive. Did you ever resolve this?

  • Airport Extreme appears to have memory leak; sluggish after long uptime

    For a long time now, I have been frustrated by what appears to be a memory leak in the Airport Extreme firmware. After the unit has been running for a few weeks (and this varies from one week to one month approximately), the WLAN to LAN routing performance will drop drastically. It will go from ping times (from a WLAN host to a LAN host) of 1 mS or less to ping times in excess of one second.
    In this broken state, all traffic through the unit is dog slow. Doesn't matter what the traffic is-- if it's to and from the wireless LAN, it's going to take forever.
    If I power cycle the Airport Extreme, the problem will go away for another few weeks. I have dealt with this issue for several years with the hope that eventually a firmware upgrade would come that fixed it. So far, no such fix.
    Is anyone else experiencing this sort of behavior? When it isn't sluggish, the unit works wonderfully with Mac, Windows and Linux wireless clients so I have no reason to blame anything but the Extreme... particularly since the bandaid is a power cycle of it.
    All of my clients are 802.11b/g, no 'n' in service here.

    Boot into safe mode (restart holding down SHIFT key). If no KP, then uninstall and reinstall those 3rd-party items that Roger pointed out, one at a time, and restart. Continue until you determine which ones are causing the problem. If KP while in safe mode, then most likely hardware related. Run the Apple Hardware Test suite, extended tests at least twice, followed by Rember.  See
    OS X About kernel panics,
    Technical Note TN2063: Understanding and Debugging Kernel Panics,
    Mac OS X Kernel Panic FAQ,
    Resolving Kernel Panics,
    How to troubleshoot a kernel panic, and
    Tutorial: Avoiding and eliminating Kernel panics for more details.

  • My tecra images, are upside down!!!! I don't know what I did!!!

    Guys, may be this is easy, but I never passed for this before. My Tecra A8-SP 4012; JUST SHOW THE DESKTOP, AND EVERY IMAGE ARE UP SIDE DOWN!!!!
    WHAT I MUST DO TO GET THE RIGHT UPSIDE AGAIN!!????
    THANKS!
    [email protected]
    ALEX POTRO CAMARENA

    You don't say what Operating System you are using.  Assuming Windows 7 (and probably for earlier OS's also but I don't know), go to Start/Control Panel/Display/Adjust Resolution/In the "Video Orientation" box, click on the drop down arrow and choose "Landscape".  It is probably now showing "Landscape Flipped".
    You may also get there by simply right clicking on the desktop and choosing Screen Resolution and then do the above.
    C.B.
    Toshiba Sat. C75D-B7260 Win 8.1 64 Bit--Toshiba Sat. L775D-S7132 Win 7 HP SP1 64 Bit and Win 10 PRO Technical Preview--Toshiba Sat. L305-S5921 Win Vista SP2 32 Bit

Maybe you are looking for

  • Fiori Sales Orders Application : No items are currently available

    Hello, I have installed and deployed SAP Fiori on top of Netweaver Gateway 7.4 and SAP ECC6 EHp5 (Pre-Production system) Both systems have been patched to the latest UI/Odata patches and latest UI notes have been applied. I am at the moment mostly in

  • How to generate mass roles in SUPC

    Hi All, I have to generate mass roles at one time. There are 3000 roles to be generated. I am using tcode SUPC to do this but when give the list of roles and click on generate button it is taking only one role. I am generating derived roles. Please a

  • TS1389 Issue with authorizing my computer

    I am trying to play a song from my librabry, when I do this, I get a pop up message telling me I need to authorize this song under the apple id.  So I go up to Store/Authorize computer, enter user id and passcode and I get a message that says that an

  • Installed trial, inst Dreamweaver, system crash, now can't load program

    I'm trying to test drive the Creative Cloud service, and I was able to download and install the Application manager and Dreamweaver CS6. After playing with it last night, I went to bed. Woke up to find my PC crashed to blue screen. Rebooted, ended up

  • Imported group does not show up

    Hi, Just converted from GW6 to GW8 and tried to follow the rules for creating a group using export of group and then import of file. However, the import does not yield any results, either to an existing group or to a new group. GW only allows import