Possible Memory leak found

About Truespace Archives

These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.

They are retained here for archive purposes only.

Possible Memory leak found // Tech Forum

1  |  

Post by remnar // Aug 9, 2008, 1:13am

remnar
Total Posts: 105
Hello. I know that the model side is not being supported. However, while developing a plugin for it, I may have found a memory leak. I have done every test and even tried using a different plugin to use the same code. What is happening is that when I initiate the

tsxImageBrowser(tsxGetTSDir(e_tsxPATH_TEXTURE));

function, with all the necessary callbacks initiated, it does it's job and gets the data. However if I close truespace, my plugin registers a huge memory leak problem. The memory leak data is a special script file that finds and outputs the information into a text file, it's called MemCheck. I'm not going to post it as it's just a lot of bloat to sift through. Now I have a tsxEvenCallback function that catches the tsxImageBrowser when it closes. I am doing every thing according to documentation to set it up right. I get the data (file name) and all is well with that. In fact I have commented out any code I have within the call back and still get a memory leak problem. I only get the memory leak when the function is called, and I select a image (double click) and the window closes, then close truespace. I was thinking my project is getting corrupted again so I moved the same code over to another plugin project and got the same memory leak problem. So I know it is nothing I'm doing. All I ask is you developers look into this. I hope that I gave enough data to help. I also want to note, that this is a bad problem and unless I get a 3rd party dll (which costs money) to support tga and other image types, I cannot release my plugin, even for testing. I could just restrict my plugin to Jpeg and Bitmap and use my own method of getting these images, but I would prefer using the built in truespace 6.6 method.

Post by Jack Edwards // Aug 9, 2008, 1:55am

Jack Edwards
Total Posts: 4062
pic
remnar, can you use the GNU png and tga libraries?

You're probably not going to want to use Model-side specific code anyway with the Workspace SDK coming out soon. The two APIs are completely different and nothing will transfer over.

I'll pass it along, but keep in mind that Model-side is discontinued and will be abandonned in the next trueSpace version. So it is unlikely that a fix will be done.

Post by remnar // Aug 14, 2008, 6:57pm

remnar
Total Posts: 105
Hello. Sorry I haven't had internet access for a week, I just moved. During the week I been working on these model side plugins. I have to apologize again, because for some reason this problem just vanished. I am assuming it's the compiler I'm using. So many strange things come and go, and I'm using some memory management tools to help me track problems down. I have tracked down some problems and other wierd and strange ones come up when they shouldn't.


I am thinking about giving up using Delphi as a compiler. It's a great program because it's so easy to create custom interfaces with. Plus the language is easy to understand unlike c. I had to deal with corrupted interfaces with this compiler. However thanks to how Delphi scripts interfaces into a file (such as a form with components is a script file) I didn't lose all my work. I was able to just create a new script and paste in the old one.


I want to clarify what really was going on with the memory leak with the image browser. My tsx program, when being destroyed, will free the forms and any other dynamic allocations. If there is a error during that process, it will catch it. What happened (for unknown reasons) is that whenever I launched the image browser from any plugin I wrote at the time, then close truespace, it would raise an Access Violation error, my code would catch it and display it. However for some reason, the internal functions of delphi that catch errors generated a memory leak (EAccessViolation object). So there is no memory leak with the image browser. And that access violation is gone for unknown reasons. Probably something to do with the compiler as it does get corrupted sometimes.


I admit I'm not a really talented programmer, nor have I been to college, I learned how to do this stuff by trial and error, and help from talented programmers like Scott J. Miles (Primitive Itch and other people. I have a clean way of writing code, and I have to test code to see how it works or if it works. I am now at a point with the Scatter plugin to be released when some documentation gets done. I am also working on Light Manager which has it's own share of strange problems (memory leak in a TList that exists within the unit that catches memory leaks lol). I prefer using the Delphi designer when making custom interfaces, I think Microsoft should learn from this. I don't like making interfaces blindly in vc++. Even custom ones I can download have some code to fiddle with before it can even show up in the running program. In Delphi, you just compile and install the package of custom components or install a single one into an existing package and you can just drag and drop and see what you get before execution. They are functional in the designer, therefore putting controls into another control such as a page of controls to be tabbed between, is visual in the designer in Delphi. I've managed to do this with vc++ 8.0 but I had to code in the visibility of controls and they had to sit ontop of each other.


I apologize for my rambling and complaining. I just wanted to share what I go through and my thoughts on why I use Delphi instead of vc++. However if I cannot get around these wierd memory issues with Delphi I may just have to go to vc++ or c#. C# and .net are interesting.

Post by Jack Edwards // Aug 14, 2008, 7:29pm

Jack Edwards
Total Posts: 4062
pic
I liked using Borland's C++ Builder compiler for some years, but I eventually had to give it up because of incompatibilities with DirectX and most other libraries.

Lately, I've been relatively happy with the VS2008. With the upgrade pricing, it is very affordable and works well. The Form designer is not as nice as the Borland one, but once you learn how to set and retrieve dialog control values via windows messaging it's not too bad. :rolleyes:

Post by brotherx // Aug 14, 2008, 10:06pm

brotherx
Total Posts: 538
pic
C++ Builder/Delphi were great for the simple way of setting and retrieving form values...more like C# but then the guy who created C# left borland for microsoft...


I really dislike MFC - it seems overly complicated to me...I prefer API stuff...he he...

or C# which is just simple.

Post by remnar // Aug 16, 2008, 6:33pm

remnar
Total Posts: 105
It'd be nice if Truespace and the new SDK were based on .net. Then Truespace would be compatible with any OS that is .net compliant and that includes any plugins you write. So using any language that uses .net would work just fine.
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn