Jump to content
  • Advertisement
Sign in to follow this  

Memory Tracker

This topic is 3934 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hiya, I've been playing with Evil Steve's memory tracker (here, thanks Steve) and it seems really good. In parts of my code, memory is dynamically allocated in a DLL, and then released in an executable. I've been having some trouble tracking this correctly because an instance of the memory manager (singleton) is created in each module (EXE, DLL). I've not really used singletons before - is there a way of sharing them between applications and DLLs? Thanks for any help [smile]

Share this post

Link to post
Share on other sites
Yes off course. Singleton is as any other object, located somewhere in memory, just pass to dll, exe memory location of it, and you will know where to find it.
Singleton is only one static object declared in class, which is ensuring you are not creating two or more instances of given class. So if you have singleton class, and you want to use it in two or more application, create it in one app as pointer and pass pointer memory address to other one, in which you set its pointer to passed pointer.
CMemMngr *manager;
//app entry point
manager = new CMemMngr();

// on later point when you loaded dll
pApp->SendMsg(MEM_MNGR_ADDRESS, &manager);

// and in other executable when you catch the message
manager = sent_address_of_manager; // <- which is pointer from first app

Never tried this but it should work.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!