View Full Version : Is it possible to store pointers in a database ?

4th April 2006, 12:18

Is it possible to store a pointer in a database.

4th April 2006, 13:23
No. Well... it is possible but it doesn't make any sense as it will become invalid when the current process is terminated and other processes can't use it too. So the answer stays at "no" :)

4th April 2006, 20:30
Pointers are virutal ... essentially offsets to real physical base addresses. So, it is conceivable that you could restore this information. I've heard of some game engines that store this type information in a database and simply restore it during runtime to avoid memory allocation performance hits. However, I have no experience with this. And, I have no understanding what OS service is leveraged to accomplish this.

4th April 2006, 21:55
The big questions are why you want to do this and how you would use it.

I have seen an app that marshalled pointers out to persistant storage, but it was overkill for what it was doing. In most cases where one wishes for persistant pointers, there is usually a better (and simpler) way to get the same functional result.

4th April 2006, 23:12
You might want to look into an object database for object persistance if that is what you are looking into.

5th April 2006, 01:42
The big questions are why you want to do this and how you would use it.

In games it takes significant time to build scene graph information -- espeically for transitions from one area/chapter of the game to another. If able to simply load portions of the database pre-constructed, then it would provide seamless (i.e. natural, smooth, continuous) transitions.

5th April 2006, 01:46
It would eliminate the time needed to re-build the constructed database; it's not just an issue of allocation as I incorrectly stated.

5th April 2006, 03:04
In the case of games you don't want to be marshalling/demarshalling pointers, it's not gaining you anything. If your performance is based on tangled web of pointers, time to redesign. You would do better to restructure your data so it can be loaded faster and use a thread to preload neighboring scenes in the background.

Besides, games are special cases that should never be used as case studies for good programming practice :-)

5th April 2006, 21:28
No offense Brandybuck ... but, you're way off here. ;)

Your statement has a certain emotional appeal. But, I think it misses the intent of my response. I wasn't promoting this as an industry best-practice for general programming ... rather trying to provide an answer to a question by Probine.

Obviously, this thread has gotten way off topic. But, I had to repsond one last time.