|
Re: How to keep track of Memory usage
[Re: Dooley]
#466788
07/03/17 01:58
07/03/17 01:58
|
Joined: Apr 2002
Posts: 1,246 ny
jumpman
OP
Serious User
|
OP
Serious User
Joined: Apr 2002
Posts: 1,246
ny
|
I can use models I guess. But why should that be a work around? Is every terrain considered a block of memory that cant be fully recovered? After doing this test: I can create an .mdl file using ent_create, then ent_purge and remove, and i can regain that memory the entity used up. But if I ent_create a terrain, and ent_purge and ent_remove, the texture memory is never fully recovered. A workaround here is just to have all your terrain placed within WED and never created. UPDATE: reloading a level (level_load), over and over again, with or without terrains is causing me to run out of memory
Last edited by jumpman; 07/03/17 02:30.
|
|
|
Re: How to keep track of Memory usage
[Re: Dooley]
#466796
07/03/17 06:00
07/03/17 06:00
|
Joined: May 2005
Posts: 868 Chicago, IL
Dooley
User
|
User
Joined: May 2005
Posts: 868
Chicago, IL
|
I am facing similar issues. It seems to be my "d3d_texbmaps" and d3d_texskins" that are stacking up with each level load.
I've created a smaller game which emulates the functions of my game in a hope to find out where the leak is coming from. So far no luck...
Each time I add a function to the smaller game to see how the memory gets handled, and so far the memory is reset on each level load. There is no stacking. However, if I keep adding functionality similar to my (big) game, eventually I'll either have a working game, or I'll discover exactly what's causing the problem.
Level_Load is "supposed" to clear out the memory, but there must be some limitation, or some loophole that allows memory to build up between loads. I will definitely follow up if I find the source of my leak.
UPDATE: Actually, I can reproduce this memory drain by loading a .wmb file into my level. It increases the overall RAM usage each time I load it, even if I purge and remove it from the level, and even after I load a new level.
|
|
|
Re: How to keep track of Memory usage
[Re: Dooley]
#466809
07/03/17 13:36
07/03/17 13:36
|
Joined: Apr 2002
Posts: 1,246 ny
jumpman
OP
Serious User
|
OP
Serious User
Joined: Apr 2002
Posts: 1,246
ny
|
Hey Dooley!
I did the same thing. In my main level, I deleted more and more objects, and spammed the level_load on the same level. If i deleted everything except the bare minimum to run my level, no memory was being stacked. After narrowing it down, i found out it was map entities causing the problem!!!!
These map entities (.wmb) are placed in the level to prevent certain nodes from seeing each other. If i had none of these map entities in the level, memory isnt stacked/leaked. But once i placed these .wmbs in the level and reloaded constantly, the memory would stack. After going into the .wmb file itself in WED, i recompiled with no shadows, along with a few other options I dont remember off hand and resaved the .wmb.
Loading the new compiled .wmb into my main level, I was able to reload constnatly without memory stacking.
Question: Why would baked shadows in a map entity (.wmb) cause memory to be unreleased in level_load??
|
|
|
Re: How to keep track of Memory usage
[Re: jumpman]
#466810
07/03/17 13:45
07/03/17 13:45
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
Question: Why would baked shadows in a map entity (.wmb) cause memory to be unreleased in level_load?? , wouldn't suprise me if it was a bug. But aren't map entities fairly slow compared to models? (I think Sivan tested this once with this map builder) Perhaps its better to just switch to models completely or perhaps bake in lower resolution shadows so the crash is more rare as a (crappy) quick fix for now .
|
|
|
Re: How to keep track of Memory usage
[Re: Dooley]
#466824
07/04/17 02:44
07/04/17 02:44
|
Joined: Apr 2002
Posts: 1,246 ny
jumpman
OP
Serious User
|
OP
Serious User
Joined: Apr 2002
Posts: 1,246
ny
|
I was able to reload/restart the level. But the map_entities definitely stacked, in the shd column!! Which meant something was going on with the shadows. And once I changed the settings of the wmb file individually, the shd never stacked in level reload. I have no idea why
UPDATE:
spoke too soon. WMB map entities placed in the level are not really freed from memory when level_load is performed.
Last edited by jumpman; 07/04/17 03:29.
|
|
|
Re: How to keep track of Memory usage
[Re: jumpman]
#466864
07/05/17 01:13
07/05/17 01:13
|
Joined: May 2005
Posts: 868 Chicago, IL
Dooley
User
|
User
Joined: May 2005
Posts: 868
Chicago, IL
|
I have found another thing that seems to help. Instead of loading a level directly, and worrying about purging different entities with ent_purge, I've found that loading a blank level seems to clear the entities automatically. Then you can load the level you need next. Something like this: level_load("Blank.WMB");//load a blank level to clear entities wait(2);
proc_kill(16);//kill all ongoing processes if necessary
bmap_purge(bitmaps);//use this command to purge bitmaps //some of them need to purged separately or they fill up the //d3d_texbmaps memory - I think you can only purge bitmaps //that were declared with a BMAP* pointer
level_load("Next_Level.WMB");//load the next level wait(2);
On my smaller game, this is not necessary. The engine seems to handle purging memory very well. I'm sure there is something in my code (on the bigger game) that is causing these problems, but I have yet to find it. In the meantime, these techniques seem to keep the memory from stacking...
|
|
|
|