Jump to content
  • Advertisement
Sign in to follow this  
fnm

using boost multi array

This topic is 2806 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In one of my project I need to handle a 3d array of 3d points and I'm using boost multi array to store it. The problem is that when I allocate a large array, say 1000x500x500 a bad_alloc exception is thrown. With smaller array all goes ok.
Here's the declaration:

boost::multi_array<Point3d, 3> m_array3d;
m_array3d(boost::extents[1000][500][500]),

Am I hitting some maximum allocation limit of multi_array? Or am I using it wrong?
Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
Assuming Point3D consists of 3 floats, 1000x500x500x3x4B = 3GB. It's probably too much. Try it with a 64-bit compiler.

Share this post


Link to post
Share on other sites
That is indeed a whopping amount of memory. If your data set is sparse, you might be better off using something like a hash-table underneath e.g. boost::unordered_map.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!