saving as external text vs. saving as part of project

Started by
0 comments, last by Agony 19 years, 4 months ago
whitch one takes more RAM or is it the same? in case you didnt get it from the thread name whitch one of these methods would save more RAM read data from external text file or have the same data embeded right into a header? thanks[smile]
____________________________"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
Advertisement
I'm assuming you're talking about a programming project, where you either have bunch of string literals in your code itself, or if you put all of the text into a file that you open at runtime and read from. You were a bit vague...

Putting your data into your code will mean that it is part of the executable. And at least on Win32 platforms, probably others, when you run a program, the whole executable is loaded into memory. Thus, your string literals will be in loaded in memory during the entire execution of your program, regardless of whether you are needing that data or not at any particular moment.

If you put it in a file, however, you can open the file whenever you need the info, close it when you're done, read only bits and pieces at a time, etcetera. In general, it will probably be [or at least, can be) more memory efficient and flexible.
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke

This topic is closed to new replies.

Advertisement