On Mar 16, 10:57 pm, "mlimber" <mlim...@gmail.comwrote:
On Mar 16, 9:46 am, klaritydef...@yahoo.co.in wrote:
Hi,
I am receving the following error when I run my application (build on C
++ code)
Program received signal SIGSEGV, Segmentation fault
si_code: 1 - SEGV_MAPERR - Address not mapped to object.
I debug using gdb to find the error and located the position where it
is throwing an error
MyFile.h
-------------
const int MAX_VALUE = 10000;
class MyClass
{
public:
MyClass();
virtual ~MyClass();
class InnerClass
{
public:
InnerClass() { }
~InnerClass() { }
};
private:
InnerClass arrObj[MAX_VALUE];
InnerClass *ptrObj;
};
MyFile.cpp
----------------
#include "MyFile.h"
MyClass::MyClass()
{
ptrObj = arrObj; // Error is thrown at this line
....}
...
I don't find anything wrong with the code. Could anyone tell me why am
I getting this signal?
I don't see anything wrong with the snippet you show. Chances are,
it's a pointer error at some (possibly unrelated) part of the code
that is causing it. Post a *minimal* but *complete* program (that is,
one that has all the code and only that code) that demonstrates your
problem. See:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8
BTW, you should probably be using an initializer list instead of
assignment. See:
http://www.parashift.com/c++-faq-lit....html#faq-10.6
You might also consider using a std::vector rather than an array:
http://www.parashift.com/c++-faq-lit....html#faq-34.1
Cheers! --M- Hide quoted text -
- Show quoted text -
Hi,
We changed the size of array value from 10000 to 1000 and it worked
fine. But now we get the same error in other place.
We thought there could be some deficiency in stack size and increased
the size of the kernel parameter "maxssiz_64bit" to a maximum value
and still we persist with the same problem.
Our application is build on HP-UX 11.23 IPF 64-bit platform and the
compiler version we use is A.06.10.
Thanks,
Thiagu