Sponsored Content
Full Discussion: Segmentation fault gdb
Top Forums Programming Segmentation fault gdb Post 302636287 by juliecf5 on Monday 7th of May 2012 08:59:19 AM
Old 05-07-2012
Segmentation fault gdb

Hello everyone,

I am using the debugger from C++ and these are the message I got:

Program received signal SIGSEGV, Segmentation fault.
0x0040cc0e in malloc_consolidate (av=0x4ff3c0) at malloc.c:5169
in malloc.c

I don't know if the problem is cause i'm trying to acess an invalid memory adress, or cause the memory of the computer is over.
I don't know how to fix it, can anyone help me?

Thank you for your help.
 

10 More Discussions You Might Find Interesting

1. Programming

Hi! segmentation fault

I have written a program which takes a directory as command line arguments and displays all the dir and files in it. I don't know why I have a problem with the /etc directory.It displays all the directories and files untill it reaches a sub directory called peers which is in /etc/ppp/peers.the... (4 Replies)
Discussion started by: vijlak
4 Replies

2. Programming

segmentation fault

ive written my code in C for implementation of a simple lexical analyser using singly linked list hence am making use of dynamic allocation,but when run in linux it gives a segmentation fault is it cause of the malloc function that ive made use of????any suggestions as to what i could do??? thank... (8 Replies)
Discussion started by: rockgal
8 Replies

3. Programming

segmentation fault.

This code is causing a segmentation fault and I can't figure out why. I'm new to UNIX and I need to learn how to avoid this segmentation fault thing. Thank you so much. Thanks also for the great answers to my last post.:):b: int main() { mysqlpp::Connection conn(false); if... (3 Replies)
Discussion started by: sepoto
3 Replies

4. Programming

Segmentation fault in C

i have this code int already_there(char *client_names, char *username) { int i; for(i = 0; i<NUM; i++) { printf("HERE\n"); if (strcmp(client_names, username)==0) return(1); } return(0); } and i get a segmentation fault, whats wrong here? (7 Replies)
Discussion started by: omega666
7 Replies

5. UNIX for Advanced & Expert Users

segmentation fault with ps

What does this mean and why is this happening? $ ps -ef | grep ocular Segmentation fault (core dumped) $ ps -ef | grep ocular Segmentation fault (core dumped) $ ps aux | grep ocular Segmentation fault (core dumped) $ ps Segmentation fault (core dumped) $ pkill okular $ ps... (1 Reply)
Discussion started by: cokedude
1 Replies

6. UNIX for Dummies Questions & Answers

Segmentation fault

#include<stdio.h> #include<malloc.h> #include<unistd.h> #include<stdlib.h> void *start_1(void *argv) { printf("thread 0x%x\n",(unsigned int)pthread_self()); pthread_exit((void*)1); } void *start_2(void *argv) { printf("thread 0x%x\n",(unsigned int)pthread_self()); return (void*)2; }... (2 Replies)
Discussion started by: vincent__tse
2 Replies

7. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

8. Solaris

Segmentation fault

Hi Guys, I just installed and booted a zone called testzone. When I logged in remotely and tried changing to root user I get this error: "Segmentation fault" Can someone please help me resolve this? Thanks alot (2 Replies)
Discussion started by: cjashu
2 Replies

9. UNIX for Dummies Questions & Answers

Using gdb to detect segmentation fault in sh?

I am using scientific linux. In the directory user/project/Build, after I ran 'make' to compile and link all the cpp files,I had no problems. But then, when I went to directory user/run/run.sh, which runs the project binary in user/project/Build/bin/project, I get a segmentation fault error. In... (1 Reply)
Discussion started by: larry burns
1 Replies

10. Programming

C. To segmentation fault or not to segmentation fault, that is the question.

Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1... I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one. Below are two very condensed snippets of which I have added the results inside the each code section. IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies
watchmalloc(3MALLOC)					Memory Allocation Library Functions				      watchmalloc(3MALLOC)

NAME
watchmalloc, cfree, memalign, valloc - debugging memory allocator SYNOPSIS
#include <stdlib.h> void *malloc(size_t size); void free(void *ptr); void *realloc(void *ptr, size_t size); void *memalign(size_t alignment, size_t size); void *valloc(size_t size); void *calloc(size_t nelem, size_t elsize); void cfree(void *ptr, size_t nelem, size_t elsize); #include <malloc.h> int mallopt(int cmd, int value); struct mallinfo mallinfo(void); DESCRIPTION
The collection of malloc() functions in this shared object are an optional replacement for the standard versions of the same functions in the system C library. See malloc(3C). They provide a more strict interface than the standard versions and enable enforcement of the inter- face through the watchpoint facility of /proc. See proc(4). Any dynamically linked application can be run with these functions in place of the standard functions if the following string is present in the environment (see ld.so.1(1)): LD_PRELOAD=watchmalloc.so.1 The individual function interfaces are identical to the standard ones as described in malloc(3C). However, laxities provided in the stan- dard versions are not permitted when the watchpoint facility is enabled (see WATCHPOINTS below): o Memory may not be freed more than once. o A pointer to freed memory may not be used in a call to realloc(). o A call to malloc() immediately following a call to free() will not return the same space. o Any reference to memory that has been freed yields undefined results. To enforce these restrictions partially, without great loss in speed as compared to the watchpoint facility described below, a freed block of memory is overwritten with the pattern 0xdeadbeef before returning from free(). The malloc() function returns with the allocated memory filled with the pattern 0xbaddcafe as a precaution against applications incorrectly expecting to receive back unmodified memory from the last free(). The calloc() function always returns with the memory zero-filled. Entry points for mallopt() and mallinfo() are provided as empty routines, and are present only because some malloc() implementations pro- vide them. WATCHPOINTS
The watchpoint facility of /proc can be applied by a process to itself. The functions in watchmalloc.so.1 use this feature if the following string is present in the environment: MALLOC_DEBUG=WATCH This causes every block of freed memory to be covered with WA_WRITE watched areas. If the application attempts to write any part of freed memory, it will trigger a watchpoint trap, resulting in a SIGTRAP signal, which normally produces an application core dump. A header is maintained before each block of allocated memory. Each header is covered with a watched area, thereby providing a red zone before and after each block of allocated memory (the header for the subsequent memory block serves as the trailing red zone for its preced- ing memory block). Writing just before or just after a memory block returned by malloc() will trigger a watchpoint trap. Watchpoints incur a large performance penalty. Requesting MALLOC_DEBUG=WATCH can cause the application to run 10 to 100 times slower, depending on the use made of allocated memory. Further options are enabled by specifying a comma-separated string of options: MALLOC_DEBUG=WATCH,RW,STOP WATCH Enables WA_WRITE watched areas as described above. RW Enables both WA_READ and WA_WRITE watched areas. An attempt either to read or write freed memory or the red zones will trigger a watchpoint trap. This incurs even more overhead and can cause the application to run up to 1000 times slower. STOP The process will stop showing a FLTWATCH machine fault if it triggers a watchpoint trap, rather than dumping core with a SIGTRAP signal. This allows a debugger to be attached to the live process at the point where it underwent the watchpoint trap. Also, the various /proc tools described in proc(1) can be used to examine the stopped process. One of WATCH or RW must be specified, else the watchpoint facility is not engaged. RW overrides WATCH. Unrecognized options are silently ignored. LIMITATIONS
Sizes of memory blocks allocated by malloc() are rounded up to the worst-case alignment size, 8 bytes for 32-bit processes and 16 bytes for 64-bit processes. Accessing the extra space allocated for a memory block is technically a memory violation but is in fact innocuous. Such accesses are not detected by the watchpoint facility of watchmalloc. Interposition of watchmalloc.so.1 fails innocuously if the target application is statically linked with respect to its malloc() functions. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
proc(1), bsdmalloc(3MALLOC), calloc(3C), free(3C), malloc(3C), malloc(3MALLOC), mapmalloc(3MALLOC), memalign(3C), realloc(3C), valloc(3C), libmapmalloc(3LIB), proc(4), attributes(5) SunOS 5.10 25 Apr 2001 watchmalloc(3MALLOC)
All times are GMT -4. The time now is 04:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy