473,321 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Receiving error "SEGV_MAPERR - Address not mapped to object"

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?

Mar 16 '07 #1
3 17067
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

Mar 16 '07 #2
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

Mar 19 '07 #3
On 19 Mar, 13:05, klaritydef...@yahoo.co.in wrote:
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 onC
++ 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.
I suppose it can depend on how you use the MyClass object, if you try
to create an instance on the stack I imagine that you could get a
stack overflow.

Is there a reason to have an array as a member of the object *and*
having a pointer to the array? Can't you just have the pointer and
allocate the array on the heap using new int the constructor?

--
Erik Wikström

Mar 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chris Magoun | last post by:
I suddenly received an unexpected error in my project. I have been working on this project for some time without this issue. Nothing has changed in the form that caused the exception. A little...
18
by: Microsoft | last post by:
When I try this in my code I alwas get an errormessage: "Object reference not set to an instance of an object" Dim g As System.Drawing.Graphics g.DrawString("Test", New Font("Arial", 12,...
0
by: Martin Widmer | last post by:
Hello again! I have a datagridview control on my form and am using VS.Net 2005. One column is set up as combo box column, and when I try to set the datasource for that combobox column at design...
3
by: =?Utf-8?B?QmFkaXM=?= | last post by:
I'm doing a server side automation(I know it's bad but..) and its working fine locally and when accessing it from a remote machine using web browser is was giving me this error"Retrieving the COM...
1
by: nguyentrongkha | last post by:
I have two asp.net applications that host on server 2003. I create a hyper link on one application that links to default page of the other application.Whenever users click on that link, I get a...
10
RMWChaos
by: RMWChaos | last post by:
WinVista/IE7 I am getting some weird errors only in IE7, but not in FF2.0.0.8 or NN9. It even happens on this website when I click "Sign In". The error is: "A Runtime Error has occurred."...
11
by: narpet | last post by:
Hello all, I'm hoping somebody can help me with this. I have an app that I've been developing in MS Visual Studio 2005 Pro, C#. I have connectivity to a SQL server database. All of the sudden,...
2
by: =?Utf-8?B?U3dhcHB5?= | last post by:
hi, I am working on application in this i am using two files. In first (consider A) file i am calling the function of other file (consider B). In that function of file B i am calling the method...
3
by: Sarah | last post by:
Hi - Please be gentle. I am quite new to visual basic, but I have been going through tutorials and reading up. I found a code snippet on the internet that I wanted to see if I could re-purpose...
5
by: dotnetnovice | last post by:
Hi everybody actually i was trying to insert some records in to SQL server through C# Wndows Aplication and during that i face an error "Object reference not set to an instance of an object." and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.