10-21-2006
Quote:
Originally Posted by jacques83
Hi,
But in my case, I am getting a list of around a couple of thousand or nore addresses, and then an eventual segmentation fault. I am running my program on linux. Isnt this a possible way?
It is a possible way. It's also a bad way, for reasons I'm not going to repeat.
Quote:
I am not allowed to use any system command
Better throw out printf, then.
Quote:
and am supposed to report my findings obtained empirically. Please comment...
Is this homework?
10 More Discussions You Might Find Interesting
1. Filesystems, Disks and Memory
I'm on solaris 8. I need to check the stack trace inside my C program. I don't have printstack or walkstack. I tested getcontext and it works. But how do I get the symbols from "stack_t" ? Help please. Many thanks! (4 Replies)
Discussion started by: rydahl
4 Replies
2. UNIX for Dummies Questions & Answers
Using ssh, is there a simple command to find files in subdirectories from, let's say, the home directory on a shared server? (2 Replies)
Discussion started by: endl
2 Replies
3. Programming
I am working on garbage collector in C?
How should :confused: I find the part of heap where the variable are stored. It there any compiler (GCC) support for this. (2 Replies)
Discussion started by: amit gangarade
2 Replies
4. Shell Programming and Scripting
Hi All ,
I have different strings (SQL queries infact) of different lengths such as:
1. "SELECT XYZ FROM ABC WHERE ABC.DEF='123' "
2. "DELETE FROM ABC WHERE ABC.DEF='567'"
3. "SELECT * FROM ABC"
I need to find out the word coming after the... (1 Reply)
Discussion started by: swapnil.nawale
1 Replies
5. UNIX for Advanced & Expert Users
How can i find( or list) contents of all registers being used by my program?
Is there any system call or library available for this?:confused:
At runtime in my c/c++ program. At runtime using may be some assembly hack!!!!!!!!!!! (2 Replies)
Discussion started by: amit gangarade
2 Replies
6. UNIX for Dummies Questions & Answers
I'm a relative newbie and apologize if this is silly... Suppose I have a file with English words and their Spanish translations. I read them in like this:
while(getline < myfile > 0) {
eng = $1
SPAN = $2
}
Now, for every eng in SPAN, I want to scan through SPAN and search for a... (2 Replies)
Discussion started by: DrLeeDetroit
2 Replies
7. Programming
Hi All,
I have a c program called findPath.c in a path /home/harsh/c-Programs/. How can i find the path where the program is stored at runtime?? I have given the following
#include<stdio.h>
int main()
{
system("dirname $0");
return 0;
}
This is resulting in the output as
.
<single dot... (6 Replies)
Discussion started by: sreeharshasn
6 Replies
8. UNIX for Dummies Questions & Answers
Hello all,
one of application on system requires that "uname" program is in "/usr/uname" location. I can find uname in "/usr/bin/uname" location. Is it possible to present the /usr/bin/uname as that it was located in /usr/uname location?
Thank you in advanced,
M (1 Reply)
Discussion started by: kreno
1 Replies
9. Programming
I need to know what is the maximum stack size i.e. -Xss my java program is running with.
Is there a way to find that out from inside my java program code and outside of it.
What i am looking for is to read whatever the current set max limit -Xss (stack sie) is for a particular JVM(not... (3 Replies)
Discussion started by: mohtashims
3 Replies
10. UNIX Desktop Questions & Answers
So I need some help with this. Pardon me if I'm posting in the wrong forum, after some googling for my answer and finding nothing I found this forum. It seemed appropriate for what I was seeking. I just didnt find a forum that concerned the use of GDB. I'm learning to use the C language and GDB.... (2 Replies)
Discussion started by: Cambria
2 Replies
CHMEM(1) General Commands Manual CHMEM(1)
NAME
chmem - change memory allocation
SYNOPSIS
chmem [+] [-] [=] amount file
EXAMPLES
chmem =50000 a.out # Give a.out 50K of stack space
chmem -4000 a.out # Reduce the stack space by 4000 bytes
chmem +1000 file1 # Increase each stack by 1000 bytes
DESCRIPTION
When a program is loaded into memory, it is allocated enough memory for the text and data+bss segments, plus an area for the stack. Data
segment growth using malloc , brk , or sbrk eats up stack space from the low end. The amount of stack space to allocate is derived from a
field in the executable program's file header. If the combined stack and data segment growth exceeds the stack space allocated, the pro-
gram will be terminated.
It is therefore important to set the amount of stack space carefully. If too little is provided, the program may crash. If too much is
provided, memory will be wasted, and fewer programs will be able to fit in memory and run simultaneously. MINIX does not swap, so that
when memory is full, subsequent attempts to fork will fail. The compiler sets the stack space to the largest possible value (for the Intel
CPUs, 64K - text - data). For many programs, this value is far too large. Nonrecursive programs that do not call brk , sbrk , or malloc ,
and do not have any local arrays usually do not need more than 8K of stack space.
The chmem command changes the value of the header field that determines the stack allocation, and thus indirectly the total memory required
to run the program. The = option sets the stack size to a specific value; the + and - options increment and decrement the current value by
the indicated amount. The old and new stack sizes are printed.
SEE ALSO
install(1), brk(2).
CHMEM(1)