curl and Apple Technotes.

Thanks

Now I use quoted form of thestring.

I am encountering an other problem.
My script triggering curl grab the contents of hundreds of technical notes by groups of 100.
The extracted datas are written in a text file.
I take care to clean the used variables after the treatment of each group.
It’s not sufficient, the memory used by the script is growing so that it may reach 3 Gbytes.
When it reach such level, I force the script to quit then restart it for a new cycle.
My understanding is that AppleScript doesn’t free the memory allocated to the variables.
Is there a way to force it to do this required cleaning ?

Yvan KOENIG (VALLAURIS, France) mercredi 12 novembre 2014 13:28:04

I don’t think that the problem is inside your script. I think Script-Editor is responsible for this as well (if you’re using script editor). When a script is run in script editor and makes used of script addition commands, somehow the results of the commands of the script additions are not freed but they remain retained. The memory leak won’t happen if the script is run by osascript or by itself. I found this issue a while ago when I wrote my own scripting addition and scared me watching it eating memory, then after some digging I found out that it wasn’t my scripting addition causing this problem but script editor itself.

here a small example:

repeat 100000 times
	offset of "a" in "MacScripter"
end repeat

The code above will eat up to about 132MB ram. When you re-run the command it will eat up 132MB ram again, and again. It’s a bug that’s in AppleScript-Editor for a long time.

Now save the script and (add a delay at the end so you can see what happens to the memory). Then run it outside script editor ( I used osascript command line utility). Now you’ll see that the script eats no memory at all. On my machine it’s stable at 2MB.

Thanks

Running in the Editor was useful to be sure that everything was OK.
As It’s right now, the next time, I will save it as an application and run the app.

With it, i put my hands upon more than 35.000 technical notes.
Knowing them will be useful to find explanations to some oddities which are referenced but which I ignored.

Yvan KOENIG (VALLAURIS, France) mercredi 12 novembre 2014 14:55:19