Sponsored Content
Full Discussion: memory layout in C on linux
Top Forums Programming memory layout in C on linux Post 86343 by parasa on Thursday 13th of October 2005 09:10:17 AM
Old 10-13-2005
memory layout in C on linux

Hi,

Does any one know what tool to use to visualize how is memory layed out for C on linux systems. I mean how much stack portion is used in functional call.
Where exactly does the argument to function sit in memory ?

I have written small program pasted below. But I am not able to infer anything with the output I am getting.
(attached is the c code)
Global variable 'add' is used to locate the stack's base.


I don't know if this technique works ? waiting for your views

Regards,
Kiran
 

8 More Discussions You Might Find Interesting

1. Red Hat

Linux memory usage

What's the best way to find out how much memory is being used/available? I tried using free, but I didn't quite understand the output. Can someone explain it? $ free total used free shared buffers cached Mem: 16304536 16256376 48160 0 ... (6 Replies)
Discussion started by: junkmail426
6 Replies

2. UNIX for Advanced & Expert Users

Memory managment - linux

Hi, I having problem with my linux machine it have 6Gb physical memory and somehow it always almost coming to the bottom neck and than it start writing to the swap memory you can see that there is more than 4G in cahce, is there any way to clean the cache or to limit it to 2Gb? host1... (6 Replies)
Discussion started by: Igal Malka
6 Replies

3. Linux

Changing default keyboard layout in Linux

Hi I have Fedora linux with XFCE desktop. I want to use Indic lanquage in that. I have installed unicode devnagri fonts. But I am not able to change my default keyboard layout. How can I change default keyboard layout in XFCE or through command line. Thanks NeeleshG (0 Replies)
Discussion started by: neel.gurjar
0 Replies

4. Red Hat

share memory on linux

how to list the orphaned shared memory? how to kill them so that shared mem is free again. thanks (9 Replies)
Discussion started by: melanie_pfefer
9 Replies

5. Linux

Linux Memory Track

Hi All, We are using the linux servers and need to track the memory utilization of the box. Could anyone advice how the same can be achived. :) (1 Reply)
Discussion started by: haitorajesh
1 Replies

6. Programming

Memory sniffing in linux

I am trying to create an application that will be able to sniff memory of other applications. I am not completely new to systems programming but I am not sure how to go about this task. I understand that accomplishing this mainly require these steps. 1: Get a list of processes 2: Find the... (2 Replies)
Discussion started by: mosey
2 Replies

7. Red Hat

Shared memory in linux

Hello, I am using Linux os. $ df -k /dev/shm Filesystem 1K-blocks Used Available Use% Mounted on tmpfs 2023256 1065000 958256 53% /dev/shm $ Based on my google this, it is shared memory. What is this shared memory and where exactly it is used? Can you... (5 Replies)
Discussion started by: govindts
5 Replies

8. Programming

"char" memory layout problem!

In the following code, why the final result of "usC=cA+(char)ucB;" is 0xFF00? In my opioion the memory layout of cA is "10000000" and (char)cB is "10000000",usC type is unsigned short ,so the result should be "100000000" ,the 0x100. Please help tell me what is wrong? Thanks!!;) ... (2 Replies)
Discussion started by: micky.zhou
2 Replies
dc(1)							      General Commands Manual							     dc(1)

Name
       dc - desktop calculator

Syntax
       dc [file]

Description
       The  command  is an arbitrary precision arithmetic package.  Ordinarily it operates on decimal integers, but you can specify an input base,
       output base, and a number of fractional digits to be maintained.  The overall structure of is a stacking (reverse Polish)  calculator.	If
       an  argument  is  given, input is taken from that file until its end, then from the standard input.  The following constructions are recog-
       nized:

       number  The value of the number is pushed on the stack.	A number is an unbroken string of the digits 0-9.  It may be preceded by an under-
	       score _ to input a negative number.  Numbers may contain decimal points.

       +  - /  *  %  ^
	       The  top two values on the stack are added (+), subtracted (-), multiplied (*), divided (/), remaindered (%), or exponentiated (^).
	       The two entries are popped off the stack; the result is pushed on the stack in their place.  Any fractional part of an exponent	is
	       ignored.

       sx      The  top  of  the  stack is popped and stored into a register named x, where x may be any character.  If the s is capitalized, x is
	       treated as a stack and the value is pushed on it.

       lx      The value in register x is pushed on the stack.	The register x is not altered.	All registers start with zero value.  If the l	is
	       capitalized, register x is treated as a stack and its top value is popped onto the main stack.

       d       The top value on the stack is duplicated.

       p       The  top  value	on  the stack is printed.  The top value remains unchanged.  P interprets the top of the stack as an ascii string,
	       removes it, and prints it.

       f       All values on the stack are printed.

       q       Exits the program.  If executing a string, the recursion level is popped by two.  If q is capitalized, the top value on	the  stack
	       is popped and the string execution level is popped by that value.

       x       Treats the top element of the stack as a character string and executes it as a string of commands.

       X       Replaces the number on the top of the stack with its scale factor.

       [ ... ] Puts the bracketed ascii string onto the top of the stack.

       <x  >x  =x
	       The top two elements of the stack are popped and compared.  Register x is executed if they obey the stated relation.

       v       Replaces  the top element on the stack by its square root.  Any existing fractional part of the argument is taken into account, but
	       otherwise the scale factor is ignored.

       !       Interprets the rest of the line as a UNIX command.

       c       All values on the stack are popped.

       i       The top value on the stack is popped and used as the number radix for further input.  When the base (number radix) is  re-set,  all
	       subsequent numbers are interpreted in the new base.

	       For  example, if the command is issued twice, first to set the base to base 2, then to reset it back to base 10, the new base value
	       must be given in the base originally set (that is, `2 i' will set the base to base 2, after which `1010 i' will set it back to base
	       10).

       I       Pushes the input base on the top of the stack.

       o       The top value on the stack is popped and used as the number radix for further output.

       O       Pushes the output base on the top of the stack.

       k       The top of the stack is popped, and that value is used as a non-negative scale factor: the appropriate number of places are printed
	       on output, and maintained during multiplication, division, and exponentiation.  The interaction of scale factor,  input	base,  and
	       output base will be reasonable if all are changed together.

       z       The stack level is pushed onto the stack.

       Z       Replaces the number on the top of the stack with its length.

       ?       A line of input is taken from the input source (usually the terminal) and executed.

       ; :     Used by for array operations.

       An example which prints the first ten values of n! is the following:
       [la1+dsa*pla10>y]sy
       0sa1
       lyx

Diagnostics
       "x is unimplemented"
       x is an octal number.

       "stack empty"
       Not enough elements on the stack to do what was asked.

       "Out of space"
       The free list is exhausted (too many digits).

       "Out of headers"
       Too many numbers being kept around.

       "Out of pushdown"
       Too many items on the stack.

       "Nesting Depth"
       Too many levels of nested execution.

See Also
       bc(1)

																	     dc(1)
All times are GMT -4. The time now is 07:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy