Question: please continue this function only // Utilities for malloc blocknode * MemoryManager::findFirstFit (unsigned int chunksize) { // returns a pointer to the first blocknode whose
please continue this function only
// Utilities for malloc
blocknode *
MemoryManager::findFirstFit (unsigned int chunksize)
{
// returns a pointer to the first blocknode whose blocksize is at least chunksize;
// if there is no such blocknode, returns nullptr
here is the memoryManager.h
}
MemoryManager.h class MemoryManager public: MemoryManager(unsigned int memtotal); unsigned char malloc(unsigned int request); void free(unsigned char * ptr2block); void showBlockList); MemoryManager.h private: blocknode *header; blocknode *trailer; unsigned int memsize; II heap size unsigned char *basepu; // pointer to first byte of heap //utilities for malloc method: blocknode*findFirstFit(unsigned int chunksize); void splitBlock(blocknode *p,unsigned int chunksize); //utilities for free method blocknode *findAllocatedBlock (unsigned char *allocated ptr); void mergeForward(blocknode *p); void mergeBackward(blocknode *p)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
