Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    177
  • comments
    531
  • views
    164118

MY MEGABYTES ARE BEING STOLED!!!

Sign in to follow this  
Scet

117 views

I seem to be having a slight memory hogging issue with Doom.Net.



All I'm doing is loading the ~14MB Doom 2 WAD and the only new data would be the 32-bit textures created from the 8-bit ones. I checked those and they only take up about 33 megabytes.

I know the task manager isn't the best program to measure this stuff, but this just won't do. I'm new to the whole .net/C# thing so does anyone know why it's raping my memory?
Sign in to follow this  


5 Comments


Recommended Comments

I'm not a .NET developer, but I spent a lot of time debugging similar things in Java (both use GC)...

It's possible that the memory footprint is due to uncollected temporary data and so on. It's not actively referenced or in-use by your code, but it was at some point in time.

I don't know about .NET, but at least in Java its fairly easy (and quite innocent) to go creating copies of things and letting them go out of scope and not realising that they aren't always immediately removed...

I assume .NET has an equivalent, but in Java there was a command line switch to enable you to monitor the GC - so you can check if it is the source of your problem...

Alternatively it could be "by design" and is an optimization by the .NET compiler - it's seeing you've got spare RAM, so it's using it [smile]

hth
Jack

Share this comment


Link to comment
I win!

In my case, it was the WAD loader assuming every lump it couldn't identify was a graphic lump, and was so creating enourmous Bitmaps. Check the WAD loader..? A quick test would be to save each image to disk once you've loaded it to see if you're only loading the right images.

As an aside, if you want to load the prerelease DOOM beta (press release WAD) the image format is slightly different to the final version; column offsets are 16, not 32 bit and you do not skip the two bytes at the start/end of a column (I haven't seen this mentioned anywhere). Not that you probably want to, but I find the old versions of DOOM interesting to wander around in and see where parts of levels have appeared and where they've changed.

Share this comment


Link to comment
Thanks Jack, I'll check that out.

Quote:

In my case, it was the WAD loader assuming every lump it couldn't identify was a graphic lump, and was so creating enourmous Bitmaps. Check the WAD loader..? A quick test would be to save each image to disk once you've loaded it to see if you're only loading the right images.


Right now the program allows me to "scroll" through each texture using the arrow keys, that's how I got the pictures for the previous journal entry. Plus my texture loader is set to throw a fit if it's not the right format. So I don't think I have the same problem you had.

I think it might be how the lumps and directory entires are allocated. I create a new instance for each entry, but only reference one at a time. Maybe that's throwing the GC off.

Share this comment


Link to comment
The GC has a function you can use to get the current memory usage "GetTotalMemory". It should at least indicate if the problem is really a problem or the Task Manager is being wonky.

Share this comment


Link to comment
Make sure you explicitly call Dispose() on all your temporarily textures or use the using keyword [wink] .

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!