c++ - How to keep a static array out of memory until first used -
I'm very new in C ++, so I'm confused to some extent how stable arrays work. I know in C # that the array is not kept in memory until it can be reached first which can be problematic if you want it to be immediately accessible. However, I am working on converting a perlin class to C ++ and I have to do more than one stable orange, of which only one runtime can be used during or during any of these realities In fact, this is not really a big memory issue because none of these will be more than 50kb, however, I want to know whether it is possible to ensure that the array is in memory then That is not loaded until I tell you not to. What is a way to ensure that a steady array defined in the source code is not loaded into memory? This is a very attractive thing (esp w / x64), but I would love to customize as much as possible. I hate memory which is not to be used.
Or maybe static arrays are not the way to go - just the dynamic class objects wrapped arrays?
I think the real question is what is the most effective solution to implement table-lookup in C ++, which can not be used by all?
No, you can not do this: statically initialized structures and arrays in C ++ Your rest is loaded with the code in the memory, so you can not affect the time at which it loads.
If you have to load your stills on the runtime, then consider changing your strategy to keep the data in a separate file, and file a constant vector
object dynamic memory This strategy is the result of keeping data in the area, while vector
can itself make the stable
object.
Comments
Post a Comment