Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 22 Oct 2014, 09:52
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
File foot-print in memory. Variables vs literals.
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Tue 06 Dec 2011, 02:31    Post subject:  File foot-print in memory. Variables vs literals.  

A run file made two ways:

With variables:
/$appPath/$file ; /$callPath/$caller

Or with literals:
/11111/22222/33333/fileName ; /aaa/bbb/ccc/callingApp

The variables in the first one hold the same strings as the second one.

The file stays in memory while the app. runs, and exits when it does.
I think that the memory foot-print is the same for both.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Thu 08 Dec 2011, 06:46    Post subject:  

using the string directly oncd should be slightly smaller, but ...

if you plan to use it more than once - use a variable
if you dont want to have incomprehensible "magic numbers" - use a variable
if you may eventually use it more than once - use a variable
if it may change - use a variable (much easier to change it in one place)
if the string already exists in a variable - use a variable (unless an outside source might change it and bork your script)

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Thu 08 Dec 2011, 20:03    Post subject:  

Hey technosaurus; I figured they were close to the same size in memory.

This is to go into a Squash file app. to run it`s exec. and stays in memory.
So I want it to be as small as possible being as it "hangs" in memory.

When the app. ends, this script calls the mount script to unmount the Squash.
Variable script:
Code:
$1/bin/Exec ; $2 -x $1 &

Usage: /Path/SqMountPt/run /Path/SqMountPt $0 &
To use the mount script: app.sq_run /Path/SqAppFile
Literal script:
Code:
/Path/SqMountPt/bin/Exec ; app.sq_run -x /Path/SqMountPt &

The mount points are always different, the path to them is always the same.
And ultimately, quite often apps. have their exec. files in different places.
The run script is generated just before the Squash app. file is made.
.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0423s ][ Queries: 11 (0.0043s) ][ GZIP on ]