LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 1998, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 29 Dec 1998 17:46:54 -0500
Reply-To:     "Self, Karsten" <Karsten.Self@SCHWAB.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         "Self, Karsten" <Karsten.Self@SCHWAB.COM>
Subject:      SAS trap -- memory allocation, _TEMPORARY_ arrays,
              and char lengt h < 8
Content-Type: text/plain

SAS requires at least 8 bytes per array element for a temporary array. It is possible to specify arrays of elements less than 8 bytes, but memory allocation is still based on a minimum of 8 bytes per cell. Assignment and values _do_ correspond to the specified length (e.g.: a 20 byte string will be truncated to 4 bytes if a length of 4 is specified).

Lengths _greater_ than 8 do result in greater memory usage, though not in a strictly linear fashion.

The issue of storage with short variables arises when building massive arrays for purposes such as in-memory processing of hash tables and the like. Common sense would say that cells half the length would require half the space (or double the number of possible elements). Not so.

FWIW, I can define arrays of up to 40,000,000 elements, requiring slightly more than 500 MB RAM, and about 15 seconds to allocate on a Sun Ultra2.

415 data _null_; stop; run;

NOTE: DATA statement used:

time: memory:

real 0:00:00.060 page faults 0

user cpu 0:00:00.004 page reclaims 0

system cpu 0:00:00.008 usage 33 K

block I/O operations: context switches:

input 0 voluntary 5

output 1 involuntary 0

416

417 data _null_;

418 array foo{2000000} $ 8 _temporary_;

419 stop;

420 run;

NOTE: DATA statement used:

time: memory:

real 0:00:00.940 page faults 0

user cpu 0:00:00.492 page reclaims 0

system cpu 0:00:00.381 usage 30.58 M

block I/O operations: context switches:

input 0 voluntary 7

output 1 involuntary 125

421

422 data _null_;

423 array foo{2000000} $ 4 _temporary_;

424 stop;

425 run;

NOTE: DATA statement used:

time: memory:

real 0:00:01.020 page faults 0

user cpu 0:00:00.510 page reclaims 0

system cpu 0:00:00.376 usage 30.58 M

block I/O operations: context switches:

input 0 voluntary 8

output 1 involuntary 94

426

427 data _null_;

428 array foo{2000000} $ 16 _temporary_;

429 stop;

430 run;

NOTE: DATA statement used:

time: memory:

real 0:00:01.260 page faults 0

user cpu 0:00:00.604 page reclaims 0

system cpu 0:00:00.573 usage 45.85 M

block I/O operations: context switches:

input 0 voluntary 7

output 1 involuntary 145

431

432 data _null_;

433 array foo{2000000} $ 32 _temporary_;

434 stop;

435 run;

NOTE: DATA statement used:

time: memory:

real 0:00:01.870 page faults 0

user cpu 0:00:00.771 page reclaims 0

system cpu 0:00:00.981 usage 76.35 M

block I/O operations: context switches:

input 0 voluntary 7

output 1 involuntary 254

-- Karsten M. Self (Karsten.Self@schwab.com) Trilogy Consulting

What part of "gestalt" don't you understand?

WARNING: All e-mail sent to or from this address will be received by the Charles Schwab corporate e-mail system and is subject to archival and review by someone other than the recipient.


Back to: Top of message | Previous page | Main SAS-L page