I have a large number of objects that have a file name stored internally. All file names are within the specified base directory (call it C:\BaseDir\ ). I am now considering two alternatives:
- Keep absolute paths in objects
- Keep relative paths in the object and optionally save the base path
If I understand Delphi strings correctly, the second approach will require much less memory, because the main path string is shared - given that I pass the same string field to all objects like this:
TDataObject.Create (FBasePath, RelFileName);
Is this assumption true? Will there be only one instance of the base path string in memory?
If someone knows a better way to deal with such situations, feel free to comment on this.
Thanks!
source share