Sponsored Content
Top Forums Programming access variable through program stack Post 302255435 by amit gangarade on Thursday 6th of November 2008 11:43:29 AM
Old 11-06-2008
access variable through program stack

I am working on garbage collector in C?
How should Smilie I find the part of heap where the variable are stored. It there any compiler (GCC) support for this.
 

10 More Discussions You Might Find Interesting

1. Programming

C program with Oracle database access

Hey, I want to access oracle database through Unix C programming.. Can you through me some light on that... (5 Replies)
Discussion started by: kavi
5 Replies

2. Shell Programming and Scripting

How to access the C program variables in shell script

hi I wanted to access the C program variables in shell script. This script is called from the same C program. What are the ways in which i can access variables thankx (3 Replies)
Discussion started by: bhakti
3 Replies

3. Programming

finding stack location in C using program

Is there a way to find the address of stack memory writing a program? Please guide me (12 Replies)
Discussion started by: jacques83
12 Replies

4. Programming

Accessing microsoft access from C program

I have read a number of references to libraries that could be linked into a C program to access various databases. I have been tasked with writing an oracle library that would be able to access an Microsoft access database. The oracle database is running on a Unix server and would have to access... (2 Replies)
Discussion started by: beilstwh
2 Replies

5. Filesystems, Disks and Memory

get stack trace from C program on Solaris 8

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

6. Shell Programming and Scripting

bin program access

Hello, I was wondering if I have something in my bin dir and I want to access it from another directory to make a change how can I go about it. Thank you. (7 Replies)
Discussion started by: gingburg
7 Replies

7. UNIX for Dummies Questions & Answers

Which program can I use for blocking unauthorized access via/ssh/ftp

Hi, I need to install a program on my Centos 5.3 server that will block unauthorized ssh/ftp access attempts. The two features I require is that I should be able to configure the program to block the IP of the intruder after a a certain amount of access attempts and that it should display a... (3 Replies)
Discussion started by: mojoman
3 Replies

8. Programming

How to read max stack size -Xss that is set/default for a java program?

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

9. Programming

Access a value in 2D array in C program

Hi All, I am new to c programming. I am getting compilation error in the below program. Can somebody help me? #include<stdio.h> #include<string.h> void main() { int i=j=0; char a={'f1',4,'f2','4'}; char count; for(i=0;i<2;i++) { for(j=1;j<=2;j++) { ... (2 Replies)
Discussion started by: sam_14189
2 Replies

10. Programming

Local variable in a C function is not getting created in stack when its compiled with GCC

Hi, I am working in UEFI EDK2 Bios source. We created a platform related new package in the EDK2 source. I find a strange issue with the platform related code we added. When I did source level debugging I noticed the local variable in a C function is not getting created in stack when its... (6 Replies)
Discussion started by: Divya R
6 Replies
GC_MALLOC(1L)															     GC_MALLOC(1L)

NAME
GC_malloc, GC_malloc_atomic, GC_free, GC_realloc, GC_enable_incremental, GC_register_finalizer, GC_malloc_ignore_off_page, GC_mal- loc_atomic_ignore_off_page, GC_set_warn_proc - Garbage collecting malloc replacement SYNOPSIS
#include "gc.h" void * GC_malloc(size_t size); void GC_free(void *ptr); void * GC_realloc(void *ptr, size_t size); cc ... gc.a DESCRIPTION
GC_malloc and GC_free are plug-in replacements for standard malloc and free. However, GC_malloc will attempt to reclaim inaccessible space automatically by invoking a conservative garbage collector at appropriate points. The collector traverses all data structures accessible by following pointers from the machines registers, stack(s), data, and bss segments. Inaccessible structures will be reclaimed. A machine word is considered to be a valid pointer if it is an address inside an object allocated by GC_malloc or friends. In most cases it is preferable to call the macros GC_MALLOC, GC_FREE, etc. instead of calling GC_malloc and friends directly. This allows debugging versions of the routines to be substituted by defining GC_DEBUG before including gc.h. See the documentation in the include files gc_cpp.h and gc_allocator.h, as well as the gcinterface.html file in the distribution, for an alternate, C++ specific interface to the garbage collector. Note that C++ programs generally need to be careful to ensure that all allo- cated memory (whether via new, malloc, or STL allocators) that may point to garbage collected memory is either itself garbage collected, or at least traced by the collector. Unlike the standard implementations of malloc, GC_malloc clears the newly allocated storage. GC_malloc_atomic does not. Furthermore, it informs the collector that the resulting object will never contain any pointers, and should therefore not be scanned by the collector. GC_free can be used to deallocate objects, but its use is optional, and generally discouraged. GC_realloc has the standard realloc seman- tics. It preserves pointer-free-ness. GC_register_finalizer allows for registration of functions that are invoked when an object becomes inaccessible. The garbage collector tries to avoid allocating memory at locations that already appear to be referenced before allocation. (Such apparent ``pointers'' are usually large integers and the like that just happen to look like an address.) This may make it hard to allocate very large objects. An attempt to do so may generate a warning. GC_malloc_ignore_off_page and GC_malloc_atomic_ignore_off_page inform the collector that the client code will always maintain a pointer to near the beginning of the object (within the first 512 bytes), and that pointers beyond that can be ignored by the collector. This makes it much easier for the collector to place large objects. These are recommended for large object allocation. (Objects expected to be larger than about 100KBytes should be allocated this way.) It is also possible to use the collector to find storage leaks in programs destined to be run with standard malloc/free. The collector can be compiled for thread-safe operation. Unlike standard malloc, it is safe to call malloc after a previous malloc call was interrupted by a signal, provided the original malloc call is not resumed. The collector may, on rare occasion produce warning messages. On UNIX machines these appear on stderr. Warning messages can be filtered, redirected, or ignored with GC_set_warn_proc This is recommended for production code. See gc.h for details. Fully portable code should call GC_INIT from the main program before making any other GC calls. On most platforms this does nothing and the collector is initialized on first use. On a few platforms explicit initialization is necessary. And it can never hurt. Debugging versions of many of the above routines are provided as macros. Their names are identical to the above, but consist of all capi- tal letters. If GC_DEBUG is defined before gc.h is included, these routines do additional checking, and allow the leak detecting version of the collector to produce slightly more useful output. Without GC_DEBUG defined, they behave exactly like the lower-case versions. On some machines, collection will be performed incrementally after a call to GC_enable_incremental. This may temporarily write protect pages in the heap. See the README file for more information on how this interacts with system calls that write to the heap. Other facilities not discussed here include limited facilities to support incremental collection on machines without appropriate VM sup- port, provisions for providing more explicit object layout information to the garbage collector, more direct support for ``weak'' pointers, support for ``abortable'' garbage collections during idle time, etc. SEE ALSO
The README and gc.h files in the distribution. More detailed definitions of the functions exported by the collector are given there. (The above list is not complete.) The web site at http://www.hpl.hp.com/personal/Hans_Boehm/gc . Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment", Software Practice & Experience, September 1988, pp. 807-820. The malloc(3) man page. AUTHOR
Hans-J. Boehm (Hans.Boehm@hp.com). Some of the code was written by others, most notably Alan Demers. 2 October 2003 GC_MALLOC(1L)
All times are GMT -4. The time now is 10:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy