Jump to content
  • Advertisement
Sign in to follow this  
saejox

Memory Usage and Memory Counter

This topic is 2345 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

Hi,

i am trying to determine how much memory scripts use.
i have overridden free and malloc with asSetGlobalMemoryFunctions.
used map<void*, size_t> for sizes.

all is well.
for objects declared in script and primitives at least.

without registered types, this counter is pretty much useless, most used types are registered stuff; Vector3, Quaternion, Degree etc...

now do i need to modify every registered object's constructors and destructor?
(including addons i think)

what about PODs, most of them dont even have destructors.

to be concise, for what type of objects my custom free/malloc will be called?

Thanks. Edited by saejox

Share this post


Link to post
Share on other sites
Advertisement
The custom memory functions are used for all memory that the script engine is allocating. This includes memory needed to store the registered interface, bytecode, the contexts and its stack, script classes, all value types, etc.

Reference types allocate their own memory, so unless you change the factory to allocate that memory from the same custom memory functions they are not counted. If you're using the add-ons you'll also have to look into the internal memory allocated, for example the buffer used by std::string, the buffer used by the array, etc.

Your own registered types are likely also allocating internal memory buffers, so you'll have to analyse those as well.

Regards,
Andreas

Share this post


Link to post
Share on other sites
i will do my own memory counting for objects created in c++ then.
i kinda hate malloc and free. there are nasty and dirty.

thanks.

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!