Heap Segmentation Fault – caused by declaration location/scope

Unexpected segmentation faults? Might be your variable declaration.

Here’s the point, declaring variables as global, is commonly known as “do you really need to?” .
Especially if it’s a dynamic sized data structure, like a C++ list.
Yeah  I realized the hard way, the size grew out of static memory bounds and got into the heap.

Good old GDB to the rescue, those error messages might be a mystery at first, it’s still potentially a beacon of hope.


Posted on July 17, 2011, in Programming and tagged . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: