Jump to content

  • Log In with Google      Sign In   
  • Create Account


EvanV

Member Since 30 Jun 2011
Offline Last Active Jul 26 2012 10:54 PM

#4829689 Memory Pool Manager Problem

Posted by EvanV on 30 June 2011 - 11:51 AM

Hello everyone,

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 259 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.



PARTNERS