I am programming a simple database in C for the IBM 5160, which has 640KB of RAM. I am compiling it with Open Watcom using a large memory model. I am having a hard time keeping track of the memory available/used by the records in my database, as I want it to grow as much as the total installed memory allows. My understanding is that there is no straightforward way to accomplish this. Therefore, I created a small function that dynamically allocates chunks of 512 bytes of RAM, cumulatively, into an array of pointers until an allocation error occurs. I then multiply the total number of allocated pointers by 512 to calculate the available RAM. Naturally, I then free the array and proceed. The result of this method shows a very low amount of memory, around 30K. Even if I compile just the function alone, without the rest of the code, the result does not change. I was under the impression that Open Watcom, set on large mode, would automatically scale up the malloc command by adding the offset part at the memory address to span across the segment.
What am I doing wrong?
What am I doing wrong?