Sponsored Content
Top Forums Programming Size of memory used by a program Post 302930706 by Don Cragun on Tuesday 6th of January 2015 01:58:09 PM
Old 01-06-2015
Quote:
Originally Posted by shamrock
Running the size command on your executable lists the sizes of the text/data/bss segments...the last 2 cols gives the size of the total data segment consumed by your executable...
Code:
size a.out  
8283 + 308 + 84 = 8675

Not quite. It shows the size of the static data segment loaded when the process starts; it doesn't show the size of data allocated while the process is running (as in the 3 calls to malloc() in the given code snippet).
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Program/ Memory Problems

I need some advise. I have an application server running several applications. When I try and start a particular application when the others are running I receive the following. This is appearing in the core file that is created. ... (1 Reply)
Discussion started by: dbrundrett
1 Replies

2. UNIX for Advanced & Expert Users

memory size under AIX

Hi, how to know size of physical memory under AIX ? Many thanks. PS : man -k memory man : 0703-310 Fichier man introuvable. uname -a AIX server1 1 5 005202DF4C00 (3 Replies)
Discussion started by: big123456
3 Replies

3. Programming

Measuring memory used by a program?

I have a Java program. I want to measure the total memory used by the program, especially the peak memory. Is there a way to do it? I have tried utilities like time (which returns 0) and top (which is not very useful) as the program does not run for long. Can anyone suggest a way to do this?... (5 Replies)
Discussion started by: spathical
5 Replies

4. Solaris

How to know the size of the program currently executing in memory

hey everybody, i am currently working on solaris 10 os on a m5000 server. my problem is when i want the exact size of a program in execution, i am unable to do it. earlier i thought the RSS field of prstat but because of its large size it cant be the size. pmap -x shows some output but it includes... (2 Replies)
Discussion started by: aryansheikh
2 Replies

5. UNIX for Advanced & Expert Users

Out of Memory error when free memory size is large

I was running a program and it stopped and showed "Out of Memory!". at that time, the RAM used by this process is around 4G and the free memory size of the machine is around 30G. Does anybody know what maybe the reason? this program is written with Perl. the OS of the machine is Solaris U8. And I... (1 Reply)
Discussion started by: lilili07
1 Replies

6. Solaris

Memory or CPU size

Is there a command or file I can look at that tells me how much real memory a machine has? A little background. In my shop we run a bunch of java programs, sometimes some of these jobs have config definitions that call for 2G. I would like to know how many I can run before I exhaust rescources. Any... (12 Replies)
Discussion started by: Harleyrci
12 Replies

7. AIX

Memory limit for C program

Greetings - I'm porting a C application to an AIX (6.1) system, and have bumped into the limits AIX imposes on memory allocation, namely the default limit of 256MB for a process. I'm aware of the compilation flag that allows an application to gain access to up to 8 memory segments (each 256MB,... (4 Replies)
Discussion started by: traviswheeler
4 Replies

8. Programming

Shared memory between two c program

i have to shared a variable between two different c programs with shared memory and i do these: int main() { int a=5,b=7; int buffer; int *point; int shmid; shmid=shmget(IPC_PRIVATE , sizeof(buffer),0666); point=(int *)shmat(shmid,NULL,0); point=a; ... (21 Replies)
Discussion started by: tafazzi87
21 Replies

9. Programming

Help regarding memory leak in this C program

I have written this code in C which reads a very large collection of text files and does some processing. The problem with this code is that there are memory leaks which I am not able to figure out as to where the problem is. When I run this code, and see the memory usage using top command, then I... (7 Replies)
Discussion started by: shoaibjameel123
7 Replies

10. UNIX for Dummies Questions & Answers

Getting file size from memory

i want to avoid writing to a file on the disk. i'd like to do this in memory. i have a situation where i'm running cat file.txt | head -l 2024 > /tmp/data.txt now, i check the size of the data.txt by doing a "du -sh /tmp/data.txt how can i get the size of "head -l 2024" WITHOUT having to... (2 Replies)
Discussion started by: SkySmart
2 Replies
st_obj_calls(3) 					     Library Functions Manual						   st_obj_calls(3)

NAME
st_is_obj_call_shared, st_is_obj_shared, st_is_obj_stripped, st_obj_name, st_obj_text_start, st_obj_text_size, st_obj_data_start, st_obj_data_size, st_obj_bss_start, st_obj_bss_size, st_obj_mem_addr - General calls for accessing information about an object file. LIBRARY
Symbol Table and Object File Access Library (libst.a) SYNOPSIS
#include <st.h> st_status_t st_is_obj_call_shared ( st_obj_t *obj, st_bool_t *cs); st_status_t st_is_obj_shared ( st_obj_t *obj, st_bool_t *shared); st_status_t st_is_obj_stripped ( st_obj_t *obj, st_bool_t *stripped); st_status_t st_obj_name ( st_obj_t *obj, char **name); st_status_t st_obj_text_start ( st_obj_t *obj, st_addr_t *text); st_status_t st_obj_text_size ( st_obj_t *obj, unsigned long *tsize); st_status_t st_obj_data_start ( st_obj_t *obj, st_addr_t *data); st_status_t st_obj_data_size ( st_obj_t *obj, unsigned long *dsize); st_status_t st_obj_bss_start ( st_obj_t *obj, st_addr_t *bss); st_status_t st_obj_bss_size ( st_obj_t *obj, unsigned long *bsize); st_status_t st_obj_mem_addr ( st_obj_t *obj, st_addr_t file_addr, st_addr_t *mem_addr); PARAMETERS
Specifies an object handle, as returned by the st_obj_open function. Specifies the address to which st_is_obj_call_shared returns a Bool- ean value of TRUE if the specified object is call-shared or FALSE if it is a nonshared or shared library. Specifies the address to which st_is_obj_shared returns a Boolean value of TRUE if the specified object is a shared library (that is, a file with an .so suffix) or FALSE if it is a call-shared or nonshared object. Specifies the address to which st_is_obj_stripped returns a Boolean value of TRUE if the sym- bol table has been stripped from the specified object. Specifies the address to which st_obj_name returns a pointer to the null-terminated string of the object name specified in a prior st_obj_open call for the specified object. Specifies the address to which st_obj_text_start returns the starting address of the object's text segment as it would reside in memory when the object is executing. Specifies the address to which st_obj_text_size returns the size of the specified object's text segment. Specifies the address to which st_obj_data_start returns the starting address of the specified object's data segment as it would reside in memory when the object is executing. Specifies the address to which st_obj_data_size returns the size of the specified object's data segment. Specifies the address to which st_obj_bss_start returns the starting address of the specified object's bss segment as it would reside in memory when the object is execut- ing. Specifies the address to which st_obj_bss_size returns size of the specified object's bss segment. Specifies an address in the spec- ified object file. st_obj_mem_addr translates this address to the equivalent address in memory to which libst has read the file. Speci- fies the address to which st_obj_mem_addr writes the address to which libst has read the file indicated by file_addr. DESCRIPTION
These routines return information about an object. Determine whether the specified object is a call-shared object, a nonshared object, or a shared library. Determines whether the symbol table has been stripped from the specified object. Returns the null-terminated string that was specified as the object's name in a prior call to st_obj_open for the specified object. Returns the starting address of the spec- ified object's text segment as it would reside in memory when the object is executing. You can use the st_obj_mem_addr function to trans- late text addresses for the executable to the address in memory to which libst has loaded a copy of the file. Returns the size of the specified object's text segment. Returns the size of the specified object's data segment. Returns the starting address of the specified object's data segment as it would reside in memory when the object is executing. You can use the st_obj_mem_addr function to translate data addresses for the executable to the address in memory to which libst has loaded a copy of the file. Returns the starting address of the specified object's bss segment as it would reside in memory when the object is executing. Because no space is allocated in the on-disk object file for the bss segment, you cannot translate the bss segment addresses using st_obj_mem_addr as you can use the function to trans- late text and data addresses. Returns the size that the specified object's bss segment would have in the executing object. Translates an address from the specified object file to the equivalent address in memory to which libst has read the file. You can then access the text and initialized data segments of a program. You cannot access the bss segments and heap because the object is not executing. RETURN VALUES
All functions indicate success by returning a value of 0 (zero). A positive return value is an errno value from a system call. A negative return value is a library error or informational code. The library codes are documented in st.h. Return parameters are set to 0 or -1 when an error occurs. Address parameters are set to 0 while file and procedure handles are set to -1. An exception to this is if a NULL pointer for the object or other return parameter is input. In these cases, the return parameters will be unchanged. A non-zero return status is the recommended method for detecting an error return from a libst function. FILES
header file that contains all definitions and function prototypes for libst.a functions RELATED INFORMATION
Commands: atom(1) Functions: libst_intro(3), st_addr_to_file(3), st_file_lang(3), st_obj_file_start(3), st_obj_open(3), st_objlist_append(3), st_proc_addr(3), st_sym_value(3) delim off st_obj_calls(3)
All times are GMT -4. The time now is 03:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy