|
Boost Users : |
Subject: Re: [Boost-users] multi_array with large dimensions crashes
From: Jothy (jothybasu_at_[hidden])
Date: 2011-08-24 05:20:13
Thanks for pointing this out.
But how to do this? I am new to c++.
Jothy
On Tue, Aug 23, 2011 at 10:42 PM, Juraj IvanÄiÄ <juraj.ivancic_at_[hidden]>wrote:
> On 23.8.2011. 12:18, Jothy wrote:
>
>> Hi all,
>>
>> I have just started to use boost libs. I am trying to create a large
>> float array (mandatory for my purpose). it works fine till certain
>> limit, but crashes above that. I think it about allocating memory in the
>> stack.
>>
>> My code is like this
>>
>> typedefboost::multi_array<**float,3>array_type;
>> typedefarray_type::indexindex;
>> array_typeArray(boost::**extents[xDim][yDim][zDim]);//**500,300,400 for
>> instance
>>
>>
>> Can some one help me to resolve this?
>>
>
> I am not familiar with multi_array, but it seems that you are creating a
> >1GB object on the stack. This will almost always crash. Try creating it on
> the heap instead. Be prepared for std::bad_alloc.
>
> HTH
>
>
> ______________________________**_________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/**mailman/listinfo.cgi/boost-**users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net