I am maintaning a memory mapped file to store my tree like datastructure.
When I'm updating the datastructure ,I got this problem. The file is limited on it's size and can't be too long or too small.
I have a methods like
void mapfile_insert_record(RECORD* /* record*/); void mapfile_modify_record(RECORD* /* record*/);
Both operations could lead to exceed the space which is free on memory file.
How do I overcome this? What strategy I should use.
- calculate whether it requires to exceed the file as a pre-condition on both methods.
- Dynamically exceed it , for a example manage a timer and constantly polling file for it's free avaliable size and then automatically extend it.
Any ideas or patterns to overcome this problem?