Click here to Skip to main content
15,889,034 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Large data sets Pin
Maximilien19-Sep-05 6:49
Maximilien19-Sep-05 6:49 
GeneralRe: Large data sets Pin
Obliterator19-Sep-05 7:25
Obliterator19-Sep-05 7:25 
GeneralRe: Large data sets Pin
ha_ha_ha19-Sep-05 8:42
ha_ha_ha19-Sep-05 8:42 
GeneralRe: Large data sets Pin
Obliterator21-Sep-05 4:15
Obliterator21-Sep-05 4:15 
GeneralRe: Large data sets Pin
ha_ha_ha23-Sep-05 5:06
ha_ha_ha23-Sep-05 5:06 
AnswerRe: Large data sets Pin
Bob Stanneveld19-Sep-05 8:06
Bob Stanneveld19-Sep-05 8:06 
GeneralRe: Large data sets Pin
Obliterator21-Sep-05 4:18
Obliterator21-Sep-05 4:18 
AnswerRe: Large data sets Pin
El Corazon19-Sep-05 8:49
El Corazon19-Sep-05 8:49 
Obliterator wrote:
Having problems in my app working with large amounts of data.

Whenever you start dealing with large memory systems you need to start thinking about how you access your data, how many times you access your data etc.

I deal with Megs to Gigs of data on occasion. A flat list of items is not always the most efficient use of memory, certainly not for speed. It has no knowledge of the contents, no optimized structure for accessing the contents. By using a vector you are in a dynamically allocating system, so if you store iterators to data, then suddenly over-run your reserve() capacity all the iterators are useless and the software can easily crash. So be very careful of your algorithms.

So the first thing I would do is verify you set it up right. Check the size() and capacity() as a diagnostic. If you notice the capacity is still increasing as you run the software, you didn't reserve enough items to hold the data, or your algorithm is using more data than you think (which amounts to the same as not reserving enough).

This could lead you to an iterator that is jumping outside your reserved size. I actually prefer a crash state in debugging because I can find what was happening at the crash state and work backwards to find why. It is sometimes long and tedious, but it is at least straight forward.

Obliterator wrote:
Whats the best way of handling large amounts of data like this?

Like I said at the start, this is dataset dependant. Only you know the contents of the raw data inside the vector and how it was intended to be used. There are bintrees, quadtrees, octtrees, as many datastructures as there are stars in the sky. But not all are suited for each type of data. Octtrees are designed well for spatially oriented data that fit in a 3 dimensional construct. If your data exceeds that of your core memory, now you get into a larger system of handling paging of out-of-core datasets -- and that is an art of its own.

So before you change your container, first make sure you understand the cause of the crash what was your size() and capacity() at the crash, was the capacity() still set to the same as what you reserved?

Then if you truly feel the container of a vector is not suffient for you needs, which may be possible, then you have to get into the guts of your data and choose something that is more efficient for access. I've done multi-dimensional lists for storage that gave my professor headaches, of course at 5 dimensions you are probably trading understanding for access speed. Which is why you always start at the contents of the data. The right tool for the right job works for software as well as woodshop.

_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
GeneralRe: Large data sets Pin
Obliterator21-Sep-05 4:51
Obliterator21-Sep-05 4:51 
GeneralRe: Large data sets Pin
El Corazon21-Sep-05 6:06
El Corazon21-Sep-05 6:06 
GeneralRe: Large data sets Pin
Obliterator21-Sep-05 6:49
Obliterator21-Sep-05 6:49 
GeneralRe: Large data sets Pin
El Corazon21-Sep-05 15:21
El Corazon21-Sep-05 15:21 
GeneralRe: Large data sets Pin
Jörgen Sigvardsson19-Sep-05 10:43
Jörgen Sigvardsson19-Sep-05 10:43 
GeneralRe: Large data sets Pin
Obliterator21-Sep-05 4:43
Obliterator21-Sep-05 4:43 
GeneralRe: Large data sets Pin
Jörgen Sigvardsson21-Sep-05 9:25
Jörgen Sigvardsson21-Sep-05 9:25 
Questionwhere to define "Enable3dControlsStatic();" Pin
valerie9919-Sep-05 5:34
valerie9919-Sep-05 5:34 
AnswerRe: where to define "Enable3dControlsStatic();" Pin
David Crow19-Sep-05 7:40
David Crow19-Sep-05 7:40 
AnswerRe: where to define "Enable3dControlsStatic();" Pin
Michael Dunn19-Sep-05 16:03
sitebuilderMichael Dunn19-Sep-05 16:03 
GeneralRe: where to define "Enable3dControlsStatic();" Pin
David Crow21-Sep-05 3:36
David Crow21-Sep-05 3:36 
GeneralRe: where to define "Enable3dControlsStatic();" Pin
Michael Dunn22-Sep-05 6:15
sitebuilderMichael Dunn22-Sep-05 6:15 
GeneralRe: where to define "Enable3dControlsStatic();" Pin
David Crow22-Sep-05 6:59
David Crow22-Sep-05 6:59 
GeneralRe: where to define "Enable3dControlsStatic();" Pin
Michael Dunn22-Sep-05 7:10
sitebuilderMichael Dunn22-Sep-05 7:10 
NewsNetworking Pin
sebastianos19-Sep-05 4:51
sebastianos19-Sep-05 4:51 
Question[Message Deleted] Pin
valerie9919-Sep-05 4:45
valerie9919-Sep-05 4:45 
AnswerRe: The one and only object been double defined Pin
MailtoGops19-Sep-05 4:59
MailtoGops19-Sep-05 4:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.