This forum has been archived. All content is frozen. Please use KDE Discuss instead.

operator new and bus error

Tags: None
(comma "," separated)
wenluyang
Registered Member
Posts
5
Karma
0

operator new and bus error

Tue Feb 16, 2016 5:22 am
Hi,
I use Eigen to do some numerical computation but meet some errors which I can't find why and how to solve.
Here is one of my class:
Code: Select all
class LoadingTractBase:public LoadingBase,public QuadEle
{
public:
    void IniConcentrationLoading(){};
    void GetConcentrationLoading(int kNum){};
    void IniDistributionLoading(Vector2i id);
    void GetDistributionXLoading(int kNum,Vector2d& qLoadx);
    void GetDistributionYLoading(int kNum,Vector2d& qLoady);
    int GetTotalLoadingNum();
    void GetId(int kNum,Vector2i& id);
    void GetEleCoor(int kNum, MatrixXd &coor);
    void GetEleId(int kNum, VectorXi &id);
    void Erease_Memory();
    void CalGauss(int kNum);
    void GetGaussCoor(int kNum,MatrixXd& gausscoor);
    void CalShapeMatrix(int kNum,int order);
    void GetWeight(int kNum,VectorXd& weight);
    void GetShapeMatrix(int kNum,MatrixXd& shapematrix);
    void GetDerShapeMatrix(int kNum,MatrixXd& dershapematrix);
    void CalJ(int kNum);
    void CalTractAll(int kNum,int order);
    void GetJ(int kNum,MatrixXd& J);
    int GetTractOrder(int kNum);
    LoadingTractBase();
    ~LoadingTractBase();
    _MLoadingTractBaseVct M_apTractBoundaryBase;
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW
protected:
    Vector2i Id;
    Vector2d qLoadx;
    Vector2d qLoady;
};


And use following code to call this class.
Code: Select all
/*...*/
if(!(cp_LoadingTractBase = new LoadingTractBase))
    {
        cout << "Error,indicator does not call right memory" << endl;
        abort();
    }
/*...*/


There is a strange error when I use this code. Sometimes it works well,
but sometimes it will report bus error,which has made me confused.


There are some pictures about this error:
http://miupix.cc/pm-DZ6DEL
http://miupix.cc/pm-IH9BXA
http://miupix.cc/pm-3ZBZQB
http://miupix.cc/pm-4XDI78
http://miupix.cc/pm-PEGZ7V

Anyone can help me with this problems?
Thanks.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: operator new and bus error

Thu Feb 18, 2016 5:45 pm
You are probably by-passing the system's memory allocator, and you thus have to tell Eigen so by compiling with de predefined macro EIGEN_MALLOC_ALREADY_ALIGNED=0.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft