473,387 Members | 1,624 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,387 software developers and data experts.

unexplainable segfaults

Hi there,

consider the following code:

#include "stdafx.h"
int main(int argc, char* argv[]) {
const int Xres = 600;
const int Yres = 600;
std::pair<float,floatdispFNabla[Yres][Xres];
std::pair<float,floatdispFNabla2[Yres][Xres];
std::pair<float,floatdispFNabla3[Yres][Xres];
std::pair<float,floatdispFNabla4[Yres][Xres];
std::pair<float,floatdispFNabla5[Yres][Xres];
std::pair<float,floatdispFNabla6[Yres][Xres];
std::pair<float,floatdispFNabla7[Yres][Xres];
std::pair<float,floatdepthFNablaZ[Yres][Xres];
float depthHessZ[Yres][Xres][4];
return 0;
}

Why in the world could it generate a segmentation fault? :

(gdb) run
Starting program: /local/home/neo/BT/P/MicroDepth
Failed to read a valid object file image from memory.

Program received signal SIGSEGV, Segmentation fault.
0x08048e0c in main () at src/MicroDepth.cxx:6
6 std::pair<float,floatdispFNabla[Yres][Xres];
(gdb) print dispFNabla
$1 = {{{first = 0, second = 0} <repeats 600 times>} <repeats 599
times>, {{
first = 0, second = 0} <repeats 277 times>, {first =
-2.67723372e-05,
second = -1.70868349}, {first = -2.89307955e-05,
second = -2.45322353e-05}, {first = -2.6772359e-05,
<snip>
second = 1.40129846e-45}...}}
(gdb) print dispFNabla2
$2 = {{{first = 0, second = 0} <repeats 600 times>} <repeats 600
times>}
(gdb) print dispFNabla3
Cannot access memory at address 0xbf66030c
(gdb) print dispFNabla4
Cannot access memory at address 0xbf3a110c

Regards,
Marc

--
DO NOT REPLY TO THIS EMAIL ADDRESS, IT WILL NOT WORK
ACTUALLY YOU WILL AUTOMATICALLY BE BLACKLISTED

May 21 '07 #1
4 1217
Marc R. wrote:
Hi there,

consider the following code:

#include "stdafx.h"
What's this?
int main(int argc, char* argv[]) {
const int Xres = 600;
const int Yres = 600;
std::pair<float,floatdispFNabla[Yres][Xres];
std::pair<float,floatdispFNabla2[Yres][Xres];
std::pair<float,floatdispFNabla3[Yres][Xres];
std::pair<float,floatdispFNabla4[Yres][Xres];
std::pair<float,floatdispFNabla5[Yres][Xres];
std::pair<float,floatdispFNabla6[Yres][Xres];
std::pair<float,floatdispFNabla7[Yres][Xres];
std::pair<float,floatdepthFNablaZ[Yres][Xres];
float depthHessZ[Yres][Xres][4];
return 0;
}

Why in the world could it generate a segmentation fault? :
Overflowed your stack?

--
Ian Collins.
May 21 '07 #2
Marc R. wrote:
Hi there,

consider the following code:
float depthHessZ[Yres][Xres][4];
Cannot access memory at address 0xbf3a110c
Almost 1.5 meg of automatic data? I'm not surprised. Use a vector or
dynamic array.

Brian
May 21 '07 #3

"Default User" <de***********@yahoo.comwrote in message
news:5b*************@mid.individual.net...
Marc R. wrote:
>Hi there,

consider the following code:
> float depthHessZ[Yres][Xres][4];
>Cannot access memory at address 0xbf3a110c

Almost 1.5 meg of automatic data? I'm not surprised. Use a vector or
dynamic array.
1.5? For that one definition, yes. But you forgot a few:
std::pair<float,floatdispFNabla[Yres][Xres];
std::pair<float,floatdispFNabla2[Yres][Xres];
std::pair<float,floatdispFNabla3[Yres][Xres];
std::pair<float,floatdispFNabla4[Yres][Xres];
std::pair<float,floatdispFNabla5[Yres][Xres];
std::pair<float,floatdispFNabla6[Yres][Xres];
std::pair<float,floatdispFNabla7[Yres][Xres];
That's about 23.3 megs in total, assuming 4 bytes per float and 8 bytes per
std::pair<float, float>, which seems a pretty reasonable assumption :)

- Sylvester

May 21 '07 #4

"Ian Collins" <ia******@hotmail.comwrote in message
news:5b*************@mid.individual.net...
Marc R. wrote:
>Hi there,

consider the following code:

#include "stdafx.h"

What's this?
That's a header file automatically generated for you when creating a new
Visual C++ project. It sets some platform-related macro values, and
#includes windows.h.

I suspect most novices don't pay any attention to it at all. I usually
remove it (and set the project to not use precompiled headers).

-Howard
May 21 '07 #5

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

Similar topics

1
by: marko | last post by:
I'm having big problems with php and mysql. php segfaults on certain mysql calls, with the following logs in apache error log: child pid 60386 exit signal Segmentation fault (11) and in the...
5
by: Naveen Parihar | last post by:
I've a binary that runs on most of our servers but segfaults on one of the servers. Further, even on this specific machine, the binary runs successfully sometimes but segfaults most of the time....
5
by: Matthias Kaeppler | last post by:
Hi, I thought it'd be a better idea to start a new thread dealing directly with my problem. Okay, here's again what's happening: I'm storing boost::shared_ptrS in an std::set. I supposed that on...
4
by: Stefan Mueller | last post by:
Why do I get the following error message in Mozilla if I press a key in the input box? ================================ Error: " nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" ...
1
by: David Douthitt | last post by:
I have a binary statically linked application that was compiled against Red Hat 7.3 (presumably glibc 2.2.5). The application SegFaults when run in a Red Hat Advanced Server environment - with...
8
by: Grant Richard | last post by:
Using the TcpListener and TcpClient I created a program that just sends and receives a short string - over and over again. The program is fine until it gets to around 1500 to 1800 messages. At...
4
by: Frank Millman | last post by:
Hi all I am using Python 2.4.1. I have machines running FC4, RH9, and MSW Server 2003 for testing. If I call sax.make_parser() from the interpreter or from a stand-alone program, it works...
9
by: Josh Zenker | last post by:
I've been working on an implementation of Dijkstra's algorithm on and off for the past few days. I thought I was close to being finished, but clearly I've done something wrong. I'm not a very...
1
by: Stefan Braumeister | last post by:
Hi NG, I got some difficult problem that drives me nuts. I wrote a relatively simple extension that reads binary files and extracts some data. If I call the script, that uses my extension via...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.