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 01 Oct 2014, 12:27
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 Posts_count  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5032
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: 4351

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: 5032
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:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


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