@Prem can u please elaborate on free memory and related concepts as well ; as aditya posted we need 2 consider that as well ...
On 8 August 2011 17:50, Aditya Virmani <[email protected]> wrote: > In malloc, u wud hav to manage free memory too, avoid fragmentation etc > > > On Mon, Aug 8, 2011 at 5:29 PM, Prem Krishna Chettri > <[email protected]>wrote: > >> If U Knw the inner DS of MM.. I can help U ... >> >> >> MALLOC :-> >> >> Jst retrun the add of the pointer from where U shoud start the >> Allocation to the point upto where U want. >> >> >> Say :- > Memeory is a chuck of space which can be represented by my global >> array like char Heap[1000]; Considering 1000 is the total heap size. Now I >> wll take a counter variable like int Count=0; to calculate the data being >> occupied. >> >> >> Now here is your malloc :- >> >> >> void * malloc ( int size) >> { >> void * loc = (void *) &Heap[Count]; >> Count=Count + size; >> retrun loc; >> } >> >> >> Now there is many flavour and check which I can explain U but probably >> this is not the better way to give Demo.. >> >> >> enjoy .. >> >> >> On Mon, Aug 8, 2011 at 5:23 PM, Aditya Virmani >> <[email protected]>wrote: >> >>> implementing these functions is not tht an easy task...google it...u ll >>> find malloc for sure...thr r diff versions available. >>> >>> >>> On Mon, Aug 8, 2011 at 10:56 AM, Aman Kumar <[email protected]> wrote: >>> >>>> Hiii >>>> >>>> >>>> tell me how to implement own realloc and malloc and free function? >>>> >>>> any link for this?? >>>> >>>> If anybody is implemented it,give code ? >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- *Dilip Makwana* VJTI BTech Computers Engineering 2009-2013 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
