Design approach, string table data, variables, stl memory usage
Posted
by howieh
on Stack Overflow
See other posts from Stack Overflow
or by howieh
Published on 2010-03-09T07:11:07Z
Indexed on
2010/03/09
10:36 UTC
Read the original article
Hit count: 740
I have an old structure class like this: typedef vector<vector<string>> VARTYPE_T;
which works as a single variable. This variable can hold from one value over a list to data like a table. Most values are long,double, string or double [3] for coordinates (x,y,z). I just convert them as needed. The variables
are managed in a map like this : map<string,VARTYPE_T *>
where the string holds the variable name. Sure, they are wrapped in classes.
Also i have a tree of nodes, where each node can hold one of these variablemaps.
Using VS 2008 SP1 for this, i detect a lot of memory fragmentation. Checking against the stlport, stlport seemed to be faster (20% ) and uses lesser memory (30%, for my test cases).
So the question is: What is the best implementation to solve this requirement with fast an properly used memory ? Should i write an own allocator like a pool allocator. How would you do this ?
Thanks in advance,
Howie
© Stack Overflow or respective owner