Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!gatech!newsfeed.internetmci.com!news.msfc.nasa.gov!news.larc.nasa.gov!lll-winken.llnl.gov!uop!pacbell.com!amdahl.com!amd!amd.com!txnews.amd.com!news
From: "Paul G. Schaaf, Jr." <paul.schaaf@amd.com>
Subject: Re: newbie question on concatenating strings
Content-Type: text/plain; charset=us-ascii
Message-ID: <DE4vKt.GDF@txnews.amd.com>
Sender: news@txnews.amd.com
Nntp-Posting-Host: hqsp86
Content-Transfer-Encoding: 7bit
Organization: Advanced Micro Devices
References: <1995Aug28.130019.29932@vtf.idx.com> <DE1pE0.61o@txnews.amd.com> <41vgp0$kvg@news-s01.ny.us.ibm.net>
Mime-Version: 1.0
Date: Wed, 30 Aug 1995 17:07:38 GMT
X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
Lines: 35

johnmci@ibm.net wrote:
>In <DE1pE0.61o@txnews.amd.com>, "Paul G. Schaaf, Jr." <paul.schaaf@amd.com> writes:
>>   stream := WriteStream on: (String new: 10000).
>>Paul.Schaaf@AMD.Com              Advanced Micro Devices, Sunnyvale, CA
>
>Paul let me ask, why 10000 bytes? I remember Russ Pencin discussing this
>at the PP-DT conference, that allocation of object over 1024 bytes (according to
>my PP manual)will go into LargeSpace. However why not pick 2K versus 10K 
>when you know the data won't even get close to that size? 
Yes, I seem to have typed 1 more zero than I had intended.  In this 
example (when the stream is being discarded in the same method), I 
suppose that making the string any larger than is necessary would not 
gain you a thing, unless the VM (or the OS) prefers to allocate memory 
blocks of certain sizes?

>As another question I know arrays get zeroed, but do indexed objects like a string
>get zeroed? what happens to those 10000 bytes of memory, does primitive 71 churn
>them to zero?
A basicInspect on String new: 10 (or 10000000000000, if you like to 
type zeros ;>) shows each slot containing a '0'.  How this is actually
accomplished (i.e. does the prim 71 or the OS set each, or does it just 
_appear_ that way?) I don't know.  

Can anyone out there answer these questions?  Inquiring minds want to 
know.


----------------------------------------------------------------------
Paul.Schaaf@AMD.Com              Advanced Micro Devices, Sunnyvale, CA
I don't speak for my company                        http://www.amd.com

"In theory, there is no difference between theory and practice, but in
 practice, there is." - unknown


