June 30th, 2011, 01:14 PM
Memory Pool Manager Problem
Recently I have been asked to write up a memory manager, something I've never done. They gave me the header file that had no virtual functions and I couldn't make any changes to. The source file had a const int called POOLSIZE and a char array called pool which was the size of POOLSIZE. I couldn't add anymore static or global variables and any information I needed to save had to be within the pool. The main they sent allocated size of a long and 255 bytes for a string. What bothers me is they also said the numbers should be close to 65530 before allocating memory and 65483 after the memory was allocated. That's 47 byte difference for 263 bytes that was actually requested. POOLSIZE is also set to equal 65536 within the source so the first 6 bytes were used for something. Am I missing something here or is there some sort of trick I'm unaware of? Maybe, I'm just reading to much into this. Anyways, if you have any ideas on the subject I'm very interested in what everyone here thinks. And if anyone could point me in the right direction to solve this problem that would be great. Thank you.
P.S: Allocations are variable size and couldn't use functions that dynamically allocated memory during the program's execution.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.