Skip to main content
Inspiring
June 14, 2013
Question

Where variables are stored in disk?

  • June 14, 2013
  • 1 reply
  • 3832 views

Hi friends

Just a question more for curiosity. It´s a technical concept question around programming.

Suppose I have a script which has variables declarated outside any function. So they are global variables.

When you are running the script, these variables "take a space in memory" and can receive values.

What´s the real concept aroud this "taking room or space in memory (or disk)"?

I mean, does the system running the script create any phisical file in the disk with the name or the variable waiting to receive (store) and read values inside? Like a text (*.txt) document???

Or the system processes global variables without creating any phisical document...and this space is disregard when concluding the running of script?

I´m using Windows 7 64 bits OS. If each variable was considered as a file, which folder is it stored? Could I check for any remaining unused variable? Could I open it? See it in disk?

Hope I was able to explain my curiosity

Thank you very much

Gustavo.

Message was edited by: Gustavo Del Vechio

This topic has been closed for replies.

1 reply

Inspiring
June 14, 2013

I think all variables, global and local, are stored in ram while the script is running. If you need to access a variable from another app while the script is running the script could write them to a file. A file can also be used to store variables between script runs. If the variables only needed to be accessed by Photoshop scripts you can also store variables in customOptions.

Inspiring
June 14, 2013

Hi Michael, thank you.

I know about the possibility to save data in text files. I use it sometimes.

So, could we conclude the variables, global or local are kept in ram only in the time the script is running? So, after the end of script, nothing are kept in disk? (concluding also variables are not files in disk, but spaces in ram memory?)

What means customOptions?

Thank you. I´m trying to improve my technical knowledge about programming. And did not find this kind of information anyplace.

Gustavo.

Inspiring
June 14, 2013

This is just my guess, but I would think that all the script's variables as well as the script it self is held in ram while the script is running. Writing the variables to a file would slow the script due to disk I/O. I would also guess with a very complex script that uses a lot of resources it might require some data to be stored in the Photoshop temp file along with all the other Photoshop data. So no, I don't think there would be files on the disk that you can access script variables unless the script creates that file.

customOptions is a Photoshop Object Model way to storing script data. You can find out more about it from the guide. Some of the sample Adobe scripts use customOptions. It is my understanding that customOptions are stored as part of the Photoshop preferences file.