Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Quad, aliswee), 835 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
How to keep track of Memory usage #466698
06/28/17 01:44
06/28/17 01:44
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
Hi everyone,

I know the statistics panel has all the relevant information regarding memory usage but I need some clarifications on some things.

sys_memory : This is the value that shows what the engine has already allocated correct? This is allocated right at the beginning of the engine. This cannot be changed.

max_nexus : this is dependant on how much ram your target computer has correct? This will be a 32bit limit, correct?

d3d_texfree: this is the amount of texture memory available from your graphics card.


So in order to keep track of memory, I was thinking of making a visual bar, that decreases when memory is taken up. What statistics should I add up to make the upper limit value of this bar? I wanted something visual like a bar to show me how much memory Im consuming, as well as keeping it simple and having just a single bar.

So if Im working on a level, and I plop in a huge terrain that has a big texture, I want to be able to see that bar change due to the terrain using memory. I can figure out the bar.

Is the total consumed memory equal to all the stats in the Memory column added up?

Re: How to keep track of Memory usage [Re: jumpman] #466699
06/28/17 02:55
06/28/17 02:55
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
also, Im noticing that using ent_purge on a terrain(.hmp) does not fully get rid of the texture memory used by the terrain. Is that normal behavior?

Re: How to keep track of Memory usage [Re: jumpman] #466700
06/28/17 08:05
06/28/17 08:05
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
I am not sure. There is a bmap_purge(bmap); function in the manual, but it says it's for C-Script.

Under ent_purge(ENTITY*); it says it releases texture memory, so it probably should not retain texture memory. I am just starting to use these commands myself, and I'm having similar issues where memory continues to pile up as I load new entities...

Re: How to keep track of Memory usage [Re: Dooley] #466704
06/28/17 09:41
06/28/17 09:41
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline
Serious User
Reconnoiter  Offline
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Quote:
max_nexus : this is dependant on how much ram your target computer has correct? This will be a 32bit limit, correct?
, I just check task manager for ram usage. Your game should be below 1400/1500 mb iirc (depends a bit per pc).

Re: How to keep track of Memory usage [Re: Reconnoiter] #466712
06/28/17 12:35
06/28/17 12:35
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
New entities will always need memory, and if I know the budget, then I can work under it. If you can work under a budget, as well as purging memory, my understanding is that you shouldn't run into memory problems.

But of course it's not that easy. I can create a model using ent_create, see the d3d_texfree decrease. When I ent_purge and ent remove, that entity, I regain that d3d_texfree. This is good. But if I create a terrain, and ent_remove, and ent_purge, the d3d_texfree slowly increases....eventually giving me nexus too small (0) errors! So if I made a game and the player continually loads a new level, this could cause memory not to be cleaned...and eventually crash.

What should I do?

Re: How to keep track of Memory usage [Re: jumpman] #466719
06/28/17 23:30
06/28/17 23:30
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
This is just a thought. I am wondering if it matters whether a texture is included in the model, or if it is external.

Also, does it matter whether a texture has been loaded with ent_morphskin?

I think, perhaps, that these external or loaded textures may not be removed by ent_purge.

If anyone knows about this, please inform...

Re: How to keep track of Memory usage [Re: Dooley] #466720
06/29/17 00:46
06/29/17 00:46
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
Also, I was never quite sure about using ptr_remove vs ent_remove.

Since ent_remove mentions that it retains the resources in memory, and ptr_remove does not mention this, perhaps ptr_remove actually removes the resources too...

Re: How to keep track of Memory usage [Re: Dooley] #466723
06/29/17 07:43
06/29/17 07:43
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
I have discovered something.

If you change an entities skin, use ent_setskin(); instead of ent_morphskin();

With ent_morphskin, it uses a string to load the bitmap. With ent_setskin, it uses a previously declared BMAP* pointer.

The difference is that you can only use bmap_purge on BMAP* pointers, not on strings. This has been my experience anyway.

Currently, I was able to load several entities, purge their entities and bitmaps and load more, and the "d3d_texskins" number stays fixed, it no longer creeps up as I add more entities...

I am still seeing overall RAM usage creeping up though, but not nearly as much as before. I believe there are some objects/entities that I have not yet purged properly, so I need to keep looking through my code...

Anyway, I hope some of this provides the info you're looking for. Let me know if you find out any more about this.

Re: How to keep track of Memory usage [Re: Dooley] #466731
06/29/17 17:01
06/29/17 17:01
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
A limitation of ent_setskin is that when you set the skin to a model it will set that skin for every instance of that model, unless you use ent_clone.

ent_morphskin does not have this limitation, and it allows different instances of the model to have different skins.

Re: How to keep track of Memory usage [Re: Dooley] #466761
06/30/17 23:23
06/30/17 23:23
Joined: May 2005
Posts: 868
Chicago, IL
Dooley Offline
User
Dooley  Offline
User

Joined: May 2005
Posts: 868
Chicago, IL
I just noticed that using ent_create to make a Map Entity will increase the nexus a bit each time it is used, even when I use ent_purge.

By replacing my Map Entity with a Model, I have eliminated this problem. Perhaps there is a similar problem with terrain (.hmp) files? Could you use a model (.mdl) instead?

Page 1 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1