wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> cs >> :o Google Question
(Message started by: saiyadshakil on Oct 4th, 2007, 1:14am)

Title: :o Google Question
Post by saiyadshakil on Oct 4th, 2007, 1:14am

How would you implement malloc in C and garbage collection in C++?

Title: Re:  :o Google Question
Post by towr on Oct 4th, 2007, 1:22am
Isn't malloc already implemented in C, why would it need to be reimplemented? Or are we writing a new compiler in C?

Title: Re:  :o Google Question
Post by saiyadshakil on Oct 4th, 2007, 9:38am
yeah it is already implemented in C but they want to see how you can implement your own MALLOC function....I mean to say .."allocate memory dynamically w/t using malloc in C"...so he gave the hint to write definition of malloc in C...

Title: Re:  :o Google Question
Post by gowrikumar on Oct 24th, 2007, 11:10am
The C Bible, K & R C has an impelemntation for malloc :-)

Hint : use brk() system call.

Title: Re:  :o Google Question
Post by saiyadshakil on Oct 24th, 2007, 12:53pm
ohhh thanks...



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board