Re: Cannot use DEBUG_NEW to trace this leak.
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Thu, 24 Jan 2008 17:00:03 -0500
36MB is not particularly large. Why do you have to read all the lines in anyway? If
you're concerned about space, line-at-a-time is slower but uses less memory.
Key here is MEASURING speed. You identify "hot spots" and fix THOSE, you don't decide a
priori and in the absence of any substantiating data that the cost of the array is the
important parameter. And if it is, you look at std::vector, and apply
std::vector::reserve if necessary, before dropping down to low-level coding.
joe
On Thu, 24 Jan 2008 22:43:02 +0200, "Simon" <spambucket@xxxxxxxxxxx> wrote:
Joseph M. Newcomer [MVP]
I think that STL containers are fast enough.
This is the problem, as it is now, (with the std::vector), the code is very
fast.
So coming up with an even faster design is hard to judge.
6 MB is not big memory allocation for today standards :)
So, you can alloc this memory block using 'new char[MAX_CHARS*MAX_LINE]',
and manage it yourself with pointers and pointers arithmetic.
Well, my file is over 36Mb, (including spaces and so forth).
And I am manipulating each lines of data to fill various string/int/float
arrays so the final size of my vector should be a lot less than 36Mb.
This is why it is a bit hard to simply read one line and place it in the
array.
I will play around with pointers, but I am not sure they will buy me more
time, (but maybe more memory).
Thanks for the info
Simon
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- Re: Cannot use DEBUG_NEW to trace this leak.
- From: Giovanni Dicanio
- Re: Cannot use DEBUG_NEW to trace this leak.
- References:
- Cannot use DEBUG_NEW to trace this leak.
- From: Simon
- Re: Cannot use DEBUG_NEW to trace this leak.
- From: Joseph M . Newcomer
- Re: Cannot use DEBUG_NEW to trace this leak.
- From: Simon
- Re: Cannot use DEBUG_NEW to trace this leak.
- From: Giovanni Dicanio
- Re: Cannot use DEBUG_NEW to trace this leak.
- From: Simon
- Cannot use DEBUG_NEW to trace this leak.
- Prev by Date: Re: Cannot use DEBUG_NEW to trace this leak.
- Next by Date: Re: Cannot use DEBUG_NEW to trace this leak.
- Previous by thread: Re: Cannot use DEBUG_NEW to trace this leak.
- Next by thread: Re: Cannot use DEBUG_NEW to trace this leak.
- Index(es):
Relevant Pages
|