void Heap_Install(void);
void *Heap_Extend(int Bytes);
void *Heap_Merge(tHeapHead *Head);
-void *Heap_Allocate(const char *File, int Line, size_t Bytes);
-void *Heap_AllocateZero(const char *File, int Line, size_t Bytes);
-void *Heap_Reallocate(const char *File, int Line, void *Ptr, size_t Bytes);
-void Heap_Deallocate(void *Ptr);
+//void *Heap_Allocate(const char *File, int Line, size_t Bytes);
+//void *Heap_AllocateZero(const char *File, int Line, size_t Bytes);
+//void *Heap_Reallocate(const char *File, int Line, void *Ptr, size_t Bytes);
+//void Heap_Deallocate(void *Ptr);
void Heap_Dump(void);
void Heap_Stats(void);
}
// Heap expands in pages
- for(i=0;i<(Bytes+0xFFF)>>12;i++)
- MM_Allocate( (tVAddr)gHeapEnd+(i<<12) );
+ for( i = 0; i < (Bytes+0xFFF) >> 12; i ++ )
+ {
+ if( !MM_Allocate( (tVAddr)gHeapEnd+(i<<12) ) )
+ {
+ Warning("OOM - Heap_Extend");
+ return NULL;
+ }
+ }
// Increas heap end
- gHeapEnd += i << 12;
+ gHeapEnd = (Uint8*)gHeapEnd + (i << 12);
// Create Block
head->Size = (Bytes+0xFFF)&~0xFFF;