heaps 
Author Message
 heaps

Hi experts of C!!!

Can you help me on a C program? I basically have to write my own malloc
function.

I want to write my own malloc function (a heap manager in C). The heap
manager is first initialized with a free region of memory using
Heap_Init. The application then makes requests of the manager to
allocated memory from the region using Heap_Alloc, and to free memory
that is no longer needed.  The heap manager can display info
about the regions in the free list using Heap_Free.

My heap.h [includes the following....]
typedef enum {NEXT_FIT, BEST_FIT, WORST_FIT} Policy;
extern int Heap_Init(void *region, unsigned int size, Policy policy);
extern void *Heap_Alloc(unsigned int size);
extern void Heap_Free(void *block);
extern void Heap_Print(void);

Can you give me some ideas on how to go about this?
It would be greatly appreciated! =)

Thanks,
Elaine =)
--



Sat, 20 Apr 2002 03:00:00 GMT  
 heaps

Quote:

>Hi experts of C!!!

>Can you help me on a C program? I basically have to write my own malloc
>function.

>I want to write my own malloc function (a heap manager in C). The heap

Good luck --
Quote:
>manager is first initialized with a free region of memory using
>Heap_Init. The application then makes requests of the manager to
>allocated memory from the region using Heap_Alloc, and to free memory
>that is no longer needed.  The heap manager can display info
>about the regions in the free list using Heap_Free.

-- all this is really platform dependent and you might do some
reading first. Next I'd simulate the whole thing, using memory
allocated by the avaiable library functions.
[...]

Ta-ta,
Juergen

--
\ Real name     : Jrgen Heinzl                 \       no flames      /

--



Sun, 21 Apr 2002 03:00:00 GMT  
 heaps

Quote:

> Can you give me some ideas on how to go about this?

Donald Knuth, The Art of Computer Progarmming, vol. 1.
--



Sun, 21 Apr 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HEAP[dllhost.exe]: HEAP: Free Heap block 1e32c28 modified at 1e32dc4 after it was freed

2. Binomial heaps / Fibonacci heaps

3. (ATL) COM dll heap vs CRT heap

4. HEAP error: Free heap block xxx mdofied at xxx

5. Invalid heap signature for heap

6. Heap errors when stressing Automation, _bstr_t, and watching heap blocks

7. Decoding a .bmp image from heap to heap

8. new and heap problems

9. /STACK increase the stack, means decrease the heap ?

10. C1060: compiler is out of heap space with VS.NET 2003 RC1

11. is the Microsoft heap manager so slow?

12. Performance problems with VS.net and heap data

 

 
Powered by phpBB® Forum Software