Coder's Guild Mailing List

memory allocation in c...

Posted by Pradeep Bisht on 2001-05-25

hi...

i'm working on a memory management library in c on sunos 5.7...

now i 'm havin'  a structure:

struct ckt{
type1* mem1;
type2* mem2;
..
..
}*ptr;

now i allocate memory to ptr.
and after that i want to allocate memory to mem1...ie memory 
to which mem1 should point..but that chunk should b large enough that...
other members ie, mem2 etc should get memory ffrom that chunk onli...

and all the members should be aligned to the correct 
memory boundaries ..in my case all the double should be aligned to 
double boundaries ...
and finally when i release memory allocated to mem1 using free(mem1)..

the whole memory should be freed....

nw i wnna know how kin i do this...means how kin i know how mucvh 
padding is neccessary so that a large chunk is allocated...



thanks in advance...


bi...bi...
with regards...
pradeep...



bi...bi...
with luv...
pradeep...