02-21-2005
Hi,
what kind of memory handling are you using in this prog ? Maybe some default values during memory allocation / free are different and you are writing more date as you orginally should ...
cheers
malcom
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hello all,
I tried a program on an array to intialise array elements from the standard input device.it is an integer array of 5 elements.but after entering the 4th element it throws a message called "Segmentation Fault" and returns to the command prompt without asking for the 5th element.
... (3 Replies)
Discussion started by: compbug
3 Replies
2. Programming
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
Hi,
Why I don't receive a segmentation fault in the following sample.
int main(void)
{
char buff;
sprintf(buff,"Hello world");
printf("%s\n",buff);
}
If I define a buffer of 10 elements and I'm trying to put inside it twelve elements, Should I receive a sigsev... (22 Replies)
Discussion started by: lagigliaivan
22 Replies
4. UNIX for Dummies Questions & Answers
Hi,
While comparing primary key data of two tables thr bteq script I am getting this Error. This script is a shell script.
*** Error: The following error was encountered on the output file.
Script.sh: 3043492 Segmentation fault(coredump)
Please let me know how to get through it.
... (5 Replies)
Discussion started by: monika
5 Replies
5. Programming
If I do this.
Assume
struct life
{
char *nolife;
}
struct life **life;
// malloc initialization & everything
if(life->nolife == 0)
Would I get error at life->nolife if it is equal to 0.
wrong accession? (3 Replies)
Discussion started by: joey
3 Replies
6. Programming
Hello Friends,
I made this program, it is running fine. when i try to add this line of code in to do repeat. It is giving segmentation error. can you please tell me how should i fix tht error.
program runs fine. when i add
char r;
if statement
while (ch r ='y')
some cofe... (4 Replies)
Discussion started by: Learnerabc
4 Replies
7. UNIX for Dummies Questions & Answers
#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
8. Programming
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
9. Solaris
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
10. Programming
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
LEARN ABOUT MOJAVE
tcl_attemptrealloc
Tcl_Alloc(3) Tcl Library Procedures Tcl_Alloc(3)
__________________________________________________________________________________________________________________________________________________
NAME
Tcl_Alloc, Tcl_Free, Tcl_Realloc, Tcl_AttemptAlloc, Tcl_AttemptRealloc, ckalloc, ckfree, ckrealloc, attemptckalloc, attemptckrealloc -
allocate or free heap memory
SYNOPSIS
#include <tcl.h>
char *
Tcl_Alloc(size)
void
Tcl_Free(ptr)
char *
Tcl_Realloc(ptr, size)
char *
Tcl_AttemptAlloc(size)
char *
Tcl_AttemptRealloc(ptr, size)
char *
ckalloc(size)
void
ckfree(ptr)
char *
ckrealloc(ptr, size)
char *
attemptckalloc(size)
char *
attemptckrealloc(ptr, size)
ARGUMENTS
unsigned int size (in) Size in bytes of the memory block to allocate.
char *ptr (in) Pointer to memory block to free or realloc.
_________________________________________________________________
DESCRIPTION
These procedures provide a platform and compiler independent interface for memory allocation. Programs that need to transfer ownership of
memory blocks between Tcl and other modules should use these routines rather than the native malloc() and free() routines provided by the C
run-time library.
Tcl_Alloc returns a pointer to a block of at least size bytes suitably aligned for any use.
Tcl_Free makes the space referred to by ptr available for further allocation.
Tcl_Realloc changes the size of the block pointed to by ptr to size bytes and returns a pointer to the new block. The contents will be
unchanged up to the lesser of the new and old sizes. The returned location may be different from ptr. If ptr is NULL, this is equivalent
to calling Tcl_Alloc with just the size argument.
Tcl_AttemptAlloc and Tcl_AttemptRealloc are identical in function to Tcl_Alloc and Tcl_Realloc, except that Tcl_AttemptAlloc and
Tcl_AttemptRealloc will not cause the Tcl interpreter to panic if the memory allocation fails. If the allocation fails, these functions
will return NULL. Note that on some platforms, but not all, attempting to allocate a zero-sized block of memory will also cause these
functions to return NULL.
The procedures ckalloc, ckfree, ckrealloc, attemptckalloc, and attemptckrealloc are implemented as macros. Normally, they are synonyms for
the corresponding procedures documented on this page. When Tcl and all modules calling Tcl are compiled with TCL_MEM_DEBUG defined, how-
ever, these macros are redefined to be special debugging versions of these procedures. To support Tcl's memory debugging within a module,
use the macros rather than direct calls to Tcl_Alloc, etc.
KEYWORDS
alloc, allocation, free, malloc, memory, realloc, TCL_MEM_DEBUG
Tcl 7.5 Tcl_Alloc(3)