I've been working on a tile engine, and I've also made a tool to test the capabilities of the engine. When loading a map, its the normal stuff of a character representing a type of tile and then the surface of tiles is created.

I've found that on my test machine (compaq laptop PIII650 64MB) that when the surface of the map is about 400x400 tiles (each tile drawn at 16x16@24bit but DirectX at 640x480@16) I get out of memory errors when I create the surface. Is the a way to calculate the amount of memory a surface will use when I know it's dimensions?