I have a question about memory management and allocation in C++.
I am implementing my version of DOM hierarchy (XML stuff, i hope someone
knows about this) and i have a HUGE memory problem.
I have implemented the hierarchy in a static library file (lib), using MSVC60.
The stress test for this is an XML file, "weighting" about 1.6 MB and
containing 200.000 elements. When i load it into my document object model classes,
the memory usage on my NT machine goes up to heaven and, for the debug
version of the library the hierarchy eats about 100 MB of memory,
simply driving me crazy! The test is made on a console app project, also in VC60.
For the release version of the library, the memory usage drops about 50%.
Still, this is HUGE amount of memory for storing a 1.6 MB file.
I have counted and measured object sizes one time and again and i cannot figure
out why does all that space gets occupied...
I know i'm a little blurry in my question, but i couldn't just paste the
class hierarchy here, given its size. Anyway, the folks who developed the DOM standard agree that
DOM implementations will have some memory problems to fight with. But, this
problem is tooooo big for me...
The vast majority of the objects are
type objects,
which is a derived type from a
I am implementing my version of DOM hierarchy (XML stuff, i hope someone
knows about this) and i have a HUGE memory problem.
I have implemented the hierarchy in a static library file (lib), using MSVC60.
The stress test for this is an XML file, "weighting" about 1.6 MB and
containing 200.000 elements. When i load it into my document object model classes,
the memory usage on my NT machine goes up to heaven and, for the debug
version of the library the hierarchy eats about 100 MB of memory,
simply driving me crazy! The test is made on a console app project, also in VC60.
For the release version of the library, the memory usage drops about 50%.
Still, this is HUGE amount of memory for storing a 1.6 MB file.
I have counted and measured object sizes one time and again and i cannot figure
out why does all that space gets occupied...
I know i'm a little blurry in my question, but i couldn't just paste the
class hierarchy here, given its size. Anyway, the folks who developed the DOM standard agree that
DOM implementations will have some memory problems to fight with. But, this
problem is tooooo big for me...
The vast majority of the objects are
Code:
<Element>
which is a derived type from a
Code:
Node[/b] object. The size of an Element,
as returned by [b]sizeof[/b] is 64 bytes.
thus,[COLOR=blue] 64 * 200000 = 12.800.000[/color], about 12 Megs... far enough from 100 MB.
I stripped all the [b]virtuals[/b] automaticly included by MSVC and i don't use any
virtual functions, so the VTable is empty.
So, could anybody tell me [b][COLOR=green] WHERE ALL THAT MEMORY GOES?[/color][/b]
Does anybody have any idea? Its not about memory leaks, i wonder if i am missing something
when using static libraries in other projects...
Heeeelp, somebody, please!!! [b][red]Nosferatu[/red][/b]
We are what we eat...
There's no such thing as free meal...