Huge .net memory Problem.

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
Locked
Darkelfv
Posts: 9
Joined: Wed Sep 13, 2006 3:26 am

Huge .net memory Problem.

Post by Darkelfv »

I have sucessfully compiled both irrlicht and irrlicht .net
I did a comparison of the terrain example in both c++ and vb.net
(modified both to handle terrain scaling and recalculating the collisions and found)

in the .net I can not release any memory for anything even it is droped.
gc.collect doesn't do anything. (drop takes a item from a refernce count and deletes the item and - 1 from the count. remove in c++, seems like all the code is traced right)

Try making a scene in .net then scenemanager.clear()

Then check your memory in taskmanager (ctrl alt delete) , boom same as it was when you had everything loaded. C++ version has not done this to me at all.

Ok Anyone got a ideal how to fix this. It seems to me the "remove" c++ is not properly being called or the code does not reflect proper garbage collection. To be honest im pretty unfamilar in this area.

Does anyone got a code fix or can point me in the right direction to get this to dump memory properly like it does in c++.

Thanks a million in advance. I know i ask all the hard questions :P
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

I found a lot of memory problems with Irrlicht .NET since it has no Dispose method (which should release all the unmanaged memory used by the app) and this was not only one fix but a complete change in Irrlicht.NET.dll.

Anyway, do never trust CTRL ALT SUPPR when using .NET ... The memory system with .NET framework makes this information often wrong (try to create a new Windows Forms project, load it and reduce the application, then maximize it... you'll understand).
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
Darkelfv
Posts: 9
Joined: Wed Sep 13, 2006 3:26 am

Post by Darkelfv »

Thanks for the reply, I did a bit more research and found that one way to fix this would be to make instance of the irrlicht unmanaged, then make a second wrapper to convert it to managed(can be done in the same code). Always deleteing itself in the desconstructor. I think over all it would make for a smaller .net wrapper that truely wrapps the functions of irrlicht. only converting from unmanaged to managed - this means little rebuilding of any function, only possible conversions of the data it passes.

I tried to implement some of this but ran into a abstract class and my lack of programing in this field has stoped me from attempting any more modifications to the existing .net project.

I am however slowly going to look at the proper way to make the wrapper for .net, I don't know if i will be sucessfull but i will start here with this tutorial I found that explains alot of what im trying to do. So eventully if htings go well I will have a .net wraper that works just as irrlicht does.

http://www.supinfo-projects.com/en/2005 ... dotnet_en/


Any suggestions or help from any of you would be highly appreciated. Im doing this in my spare time so don't expect anything from me. If i suceed I will be happy to give it to the comunity. if not well im learning alot.

I don't mind c++ as a language however the power and ease of vb.net makes me code what i imagin with out much thought. Its a great enviorment and I prefer it over any other language i have coded. Arguing that even though any other .net compiles to the same thing with same performence, I just like vb and its syntax. Why I am so interested in this wrapper and making it 100% working compatable with irrlicht. I have not found a better engine for my needs.
shurijo
Posts: 148
Joined: Sat Feb 21, 2004 3:04 am

Post by shurijo »

There's a C# (pure .NET) Irrlicht port around here somewhere. Might want to look in the project forum. I think its called Irrlicht#. There's tons of C# to VB.NET code converters out there, but you should check it out and see if its any different.
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

Post by buhatkj »

there is also of course deusXL's c# wrapper, from his sig above...
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
Darkelfv
Posts: 9
Joined: Wed Sep 13, 2006 3:26 am

Post by Darkelfv »

Thanks guys, I will look into them, Also there is me learning how to actuly do this hehe but if its already done and has what i need it will deffiantly save some time.
Darkelfv
Posts: 9
Joined: Wed Sep 13, 2006 3:26 am

Post by Darkelfv »

Well I looked into irrlicht.net cp, a great wrapper but This has the same memory problem as irrlicht.net

When i create a new terrain selector there is no way to release the memory properly. So my program gains 2 megs everytime i recreate the terrain collision map.

In c++ version of irrlicht selector->drop works and releases the memory with out issues.

irrlicht.net cp is a great wrapper and has parllax mapping and alot of cool features found in irrlicht.

Im still researching this wierd memory issues and trying to find how it can be solve with in the .net enviorment.
DeusXL
Posts: 114
Joined: Sun Mar 14, 2004 9:37 am
Contact:

Post by DeusXL »

I told you, there's no way to really have the current amount of memory since with .NET the memory is really released only when the Operating System needs it.

Anyway, you can release by doing :
terrain.Dispose();

BTW I worked a lot on the memory system of the wrapper, you must know that when the object is no longer needed it calls drop() C++ function !
You should really try to do :
terrain.Remove();
terrain.Dispose();
And see what happens when the memory reaches the limit ;)

PS : If you really want to see what I mean, minimize your app at anytime, you'll see the memory release into Windows' ctrl alt suppr
Irrlicht .NET complete and Cross Platform Wrapper
The kid on my avatar wrote:A painless lesson is one without any meaning
Celtic
Posts: 2
Joined: Fri Oct 13, 2006 9:25 am

Post by Celtic »

I have to agree with DeusXL,

I have also done extensive test in terms of memory usage and disposal of unmanaged resources and I have found that with .NET the memory only gets released when needed.

I have not yet run into any memory problems, but I do have alot of it available. Perhaps someone alot wiser could perform a test to see if this is a big problem.. ?

Kind Regards

Celtic
Locked