Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!adm!GLASGOW@NOSC-TECR.arpa From: GLASGOW@NOSC-TECR.arpa Newsgroups: comp.unix.wizards Subject: Problems with pointers Message-ID: <9519@brl-adm.ARPA> Date: Mon, 28-Sep-87 14:54:16 EDT Article-I.D.: brl-adm.9519 Posted: Mon Sep 28 14:54:16 1987 Date-Received: Tue, 29-Sep-87 06:24:46 EDT Sender: news@brl-adm.ARPA Lines: 32 I am working ona a Sun 3/50 running SunOS V4.2. I am trying to use a generic pointer that I can use to point to one of several different data structures. I declare the pointer as: typedef struct { /* massive declarations */ ... } some_big_structure; int *p; and by using: p = (some_big_structure *)malloc(sizeof(some_big_structure)); I can get p pointing to a memory block of the correct size for the structre. My problem arises when I try to release this memory back to the system. If I use free(), will it assume that p points to an integer and release only two bytes, or will it know that p is a larger structure and release the proper number of bytes. Also, if it releases only two bytes, is there a way around this. All of the different structures are large and memory is tight, so this is definitely a problem. All repsonses will be greatly appreciated. michael glasgow@marlin.nosc.mil NOSC - San Diego