Re: Strings
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Tue, 07 Nov 2006 07:00:46 -0500
Yes.
When allocating memory, there is *always* the possibility that the allocation will fail
and you will get a NULL pointer back. So assume that this is always possible.
APpending data to a string is a very expensive operation. Given you know the maximum size
of the string, this is a place where you might want to pre-allocate a buffer of 3MB and
just fill it. Whether or not you later convert it to a CString is yet a different
question.
joe
On Tue, 7 Nov 2006 03:16:02 -0800, Alamelu <Alamelu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
In one of the scenario, i need to keep on appending data to a string. TheJoseph M. Newcomer [MVP]
final data size will be of 3 MB, (i.e) the string had to hold data of 3 MB,
the string had to be in memory util 3MB data is getting filled up
Will there be any risk or any crash happening?
Regards,
Alamelu N
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Prev by Date: Re: accessing member function of a class fm other class
- Next by Date: Re: MessageBox
- Previous by thread: accessing member function of a class fm other class
- Next by thread: Thread exits during the call to CreateThread()
- Index(es):
Relevant Pages
|