Sponsored Content
Top Forums Programming Size of memory used by a program Post 302931311 by shamrock on Monday 12th of January 2015 12:27:55 PM
Old 01-12-2015
Quote:
Originally Posted by Don Cragun
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).
It is correct that the size command wont tell us anything about the runtime size of the heap allocated...but even accounting for malloc wont tell us how much data is allocated on the stack where function arguments and local variables are pushed...
 

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
stringdups(1)						    BSD General Commands Manual 					     stringdups(1)

NAME
stringdups -- Identify duplicate strings or other objects in malloc blocks of a target process SYNOPSIS
stringdups [-minimumCount count] [-stringsOnly] [-nostacks] [-callTrees] [-invertCallTrees] pid | partial-executable-name | memory-graph-file DESCRIPTION
stringdups examines the content of malloc blocks in the specified target process. For all blocks which have the same content, it shows a line with the number of such blocks, their total allocated size (the total size in the malloc heap, not just the specific size of their con- tent), and the average allocated size. stringdups requires one argument -- either the process ID or the full or partial executable name of the process to examine, or the pathname of a memory graph file generated by leaks. When generating a memory graph with leaks for use with stringdups it is necessary to use the -fullContent argument to include labels describing the contents of memory. If the MallocStackLogging environment variable was set when the target process was launched, stringdups also displays stack backtraces or call trees showing where all the blocks with a particular grouping of content were allocated. stringdups gathers the content of blocks of various types including: o C strings (composed of UTF8 characters, null terminated, of any length) o Pascal strings (composed of UTF8 characters with length byte at start, no longer than 255 characters, not necessarily null terminated) o NSString of all types (immutable, mutable, UTF8, Unicode). Malloc blocks which are the storage blocks for non-inline or mutable NSString's are listed separately. The string content is shown for both but the block sizes accurately show what is allocated in the mal- loc heap for that particular chunk of storage. o NSDate o NSNumber o NSPathStore2 (Cocoa's representation of file paths) o __NSMallocBlock__ For these, stringdups shows the symbol name of the code block (^) that this storage is associated with. If debug information is available, the source path and line number of the code block are also shown. o item counts for collection classes such as NSArray, NSSet, and NSDictionary OPTIONS
-minimumCount count Only print information for object descriptions which appear at least count times in the target process. The default minimum count is 2. To see all strings in the target process, use 1 or use 'heap <pid> -addresses all'. -stringsOnly Only print information for objects that have string content such as C or Pascal strings, or NSString. -nostacks Do not print stack backtraces or call trees even if the target process has the MallocStackLogging environment variable set. -callTrees If stack backtraces are available, then by default all the object descriptions for a particular stack backtrace are con- solidated together. However if this argument is passed then the output is consolidated by each particular string and a call tree is displayed showing the allocation backtraces of all occurrences of objects with that description. This out- put can be very lengthy if minimumCount is a low value, because the same call tree may be displayed many times. -invertCallTrees Same as except that the call trees are printed from hottest to coldest stack frame, so the leaf malloc call appears first. SEE ALSO
heap(1), leaks(1), malloc_history(1), vmmap(1), DevToolsSecurity(1) BSD
July 2, 2016 BSD
All times are GMT -4. The time now is 12:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy