Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / So...Memory Leaks. Help me find a solution!

Author
Message
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Feb 2018 12:21
Posted this in Ortu's game thread, but not maybe everyone checks that...sooo

More obsessive memory monitoring has led me to this discovery...

I was testing some new code and an important email came in, I minimized the test to check the email

Before I minimized the DBP Window, I was at 30MB memory used. (Ortu got me freaked out about mem leaks so I always check! )

After restoring the window...imagine my surprise when I was at 4MB memory used! Ran about my level and it didn't grow back up to the initial 30MB, it stayed at round 4MB....

Weird right! So I added some test code at the end of the main loop.

mainloop=1
Do
// do my game code here

Sync

//Then add the magic memory reducer at the end of the main loop
if mainloop=1
minimize window
restore window
mainloop=2 //only execute once.
endif

LOOP

Works every time! Reducing the initial memory by almost 80%! (for me)

What kind of Voodoo is this?

Continued...

Placement of the magic code seems to matter, at the very end of the loop AFTER the sync, I get 80% memory savings. 30 mb to 4 mb

At the start of the main loop, I still save some memory, 30MB down to 9MB (so 2/3 of the memory I save)

So, if we can find another DBP command that does the same thing without minimizing/restoring the window....

Or if whatever windows DLL DBP is calling for min/restore window, but only use the parts that free the memory, we can call only those parts.

I'm not a DLL master, so any help figuring this out is appreciated.
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Feb 2018 12:26 Edited at: 18th Feb 2018 12:32
for example in this snippet, memory will leak like crazy.

sync on
sync rate 0
Do
make camera 1
delete camera 1
Sync
Loop

but let it run a while, then MINIMIZE and then RESTORE the window and all that leaked memory is freed!
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Feb 2018 13:27 Edited at: 18th Feb 2018 13:30
one thing

print "System:";system smem available()


doesn't reflect the memory saved back with min/restore

Not sure what's going on with that command.

It's like it will save the initial mem in a variable the first time system smem available is called, then decrements on mem usage, but never actually UPdates the variable if mem is cleared/freed.

For example, I will let the mem leak to 100MB, min/restore window, smem won't start going down again until it reaches the point where I did the min/restore.

curiouser and curiouser
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Feb 2018 13:58
Ok...so it seems the smem command will eventually catch up with the freed memory after a min/restore, but it takes its good old time doing it.

if I stop the leak, do a min/restore, then wait a bit, the smem will slowly start increasing.
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Feb 2018 14:22 Edited at: 18th Feb 2018 14:27
Test code...might have to increase the loop

if loop3 <25000

to a higher number if you have a beefy machine.


Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Feb 2018 14:32
so you can run that test code, when the loop is done, min/res the window, and the smem # should almost catch up or sometimes, even surpass it's initial value ( the loop2 value).
James H
13
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 18th Feb 2018 15:25 Edited at: 18th Feb 2018 15:32
I am not seeing the behaviour you describe. Perhaps a mention of what version of dbp/upgrade you`re using might explain that - using standard dbp here with U7.7(rc7) on win7 64. SMEM does not work for me at all, always reports same value - the amount installed in my machine. In fact I have no way of finding the app's memory usage other than taskmanager.

Likewise minimising/restoring the window does not recover any leaked memory for me.

Edit:
Your first snippet produces an exe of 8232k for me, if I rem out the window commands it actually gets reduced to 1620k, presumably the difference is the cost of including the dll for those commands.
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 19th Feb 2018 00:06
Quote: "Likewise minimising/restoring the window does not recover any leaked memory for me."


You must have a very special computer, James. Maybe it's the 64 bit OS thing.

Windows XP Home SP3 here.

In 1.0761, memory leaks, min/restore frees that memory.

In 1.077, memory leaks, min/restore frees that memory.

Are you telling me the make camera, delete camera snippit doesn't leak memory for you or that min,restore doesn't free it? Or both?
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 19th Feb 2018 00:27
Quote: "Your first snippet produces an exe of 8232k for me, if I rem out the window commands it actually gets reduced to 1620k, presumably the difference is the cost of including the dll for those commands."


It also doesn't leak any memory. The following snip does.

Try this, hit the spacebar after you've leaked a bunch of memory in TaskManager. It should free the leaked memory and start counting up again.

Do
// do my game code here

make camera 1
delete camera 1
Sync

//Then add the magic memory reducer at the end of the main loop
if keystate(57)=1 //SPACEBAR
minimize window
restore window
endif

LOOP
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 19th Feb 2018 00:46 Edited at: 19th Feb 2018 00:52
Task Manager Images

tm1 //start of program
tm2 //lets let some memory leak
tm3 //min/restore frees the leaked memory

I'm not imagining that min/restore frees the memory

tm1 //start of program



tm2 //lets let some memory leak



tm3 //min/restore frees the leaked memory


Attachments

Login to view attachments
James H
13
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Feb 2018 00:59
Yes I get the leak no problems there lol, but yeah its the minimize/restore part that doesn't recover the leaked memory that is the issue. It's more than likely the fact you have XP. Being 64 bit should not have anything to do with this - DBP apps are all 32 bit.

If anyone has M1U installed be aware there is a restore window command in there(number 13 dll). I checked both versions, same result. I think it shouldn't matter though, I didn't have the required msvcx or mfc dlls in the project folder so I assume it found the standard command by itself, that said I removed number 13 dll to be sure, no changes in result.
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 19th Feb 2018 01:28
I guess I have M1U installed by default.

removed the 13.dll, ran again

Either one has the same result for me.
James H
13
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Feb 2018 01:57 Edited at: 19th Feb 2018 02:02
I actually wanted this to work, for another workaround to be found Need more folks to test different and same OS's really, and report which version of dbp/upgrade they use, just in case my machines set up is throwing a spanner in the works I would like another win7 64 bit user to confirm the result as well as a 32 bit user. Apparently service pack 2 is just an update to service pack 1 for win7, says kb976932 but I don't have it listed in my updates. I do have SP1 but the updates could well be from the kb976932.exe and the kb976932 might not get listed I suppose. But in any case this is a custom version of win7 using my own key from my own disk, it came with SP1 already with the installation .iso, and I am loath to do any updates at all as it has ran smooth as anything for a few years now - only ever gets turned off every few days when I go out - the whole machine and install still feels fresh!

Edit: Looks like I still have SP1, according to some youtube vid I just watched, a specific value in regedit shows which version. For me to update though will have to wait a few weeks until I get a second HDD for backup. Am not otherwise risking it, I have updated win10 through update system before now and lost contents from SSD after it somehow corrupted the mbr. If anyone has win7 can they please do this test of zeps? Will take you all of 10 seconds
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 19th Feb 2018 03:00
I would say it's a specific Windows DLL in XP that contains the min and restore code. For Win 7 that DLL may have been updated/changed.

If I knew what DLL that was I could drop it (mine) in the project folder and load dll/call the min/restore routines manually. Then see if we get the same results.
James H
13
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 19th Feb 2018 03:45
User32.dll but it also needs GDI32.dll, KERNEL32.dll, ntdll.dll, as it will auto load them. If one isn't loaded user32.dll won't either according to that link, whether or not including them will work I don't know, maybe it will use those already installed, neither do I know if it is a safe thing to do, don't know first thing about dll's really.
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 19th Feb 2018 07:15
Quote: "User32.dll but it also needs GDI32.dll, KERNEL32.dll, ntdll.dll, as it will auto load them. If one isn't loaded user32.dll won't either according to that link, whether or "


Apparently, you can't load a system dll from another folder and use that. DBP just crashes when you try to call something.

So back to the drawing board...

Ortu
DBPro Master
12
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 19th Feb 2018 18:00
unfortunately the minimize trick does not work on my windows 10 machines either.

I tried it with each of the window types: full screen, fulldesktop, window etc.

Also, verified that set display mode and flush video memory commands have no effect on the delete camera leak.

Also verified that Stab in The Dark' s memory management plugin has no effect on this leak either

mm_evictManagedMemory()
mm_releaseD3Ddevice

http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Stab in the Dark software
Valued Member
17
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 19th Feb 2018 19:06
I do not use DBPro any more but this sounds like you are just getting a lost device.
This would account for the lower memory usage.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Mage
13
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 19th Feb 2018 22:07 Edited at: 19th Feb 2018 22:33
I used this snippet and also saw a memory leak:


Make Camera / Delete Camera memory leak has been discussed before and is a known issue.

Suggestion #1 (Do things the proper way instead)
Constantly making and deleting cameras is bad form. Instead plan out which cameras you need and use Sync Mask.

If you are doing things properly your game will have 1 Sync command. All of your extra camera's will be setup and they will also be registered properly using the Sync Mask command. This is so that one Sync command can count backwards to camera 0, rendering all of the cameras along the way one at a time. Cameras that are not currently needed are simply not rendered by using Sync Mask to disable them. This is the most performance efficient method. This requires proper management of your cameras and rendering instead of doing it piecemeal like some tiny code example would.

Shameless plug: I built proper camera management support into my modular code library for this very reason. Simply add or remove cameras you want rendered.
https://forum.thegamecreators.com/thread/220759


Suggestion #2 (Doesn't work here but works for other kinds of memory leaks like loading AVI animations)
I have used the Set Display Mode command to flush leaked memory. This causes a lot of the assets to be deleted all at once (Images, Sprites, Animations, Objects) so it's not useful in all situations. You might be able to at least mitigate the problem to some degree.
Normally in a typical small DBPRO program you would call Set Display Mode once. However you could possibly call it each time a level starts to load, or a scene changes, where you might be able to gracefully recover from loss of assets without the player knowing.
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 19th Feb 2018 23:23
Something in the min/res calls on XP frees the memory, and I don't get a lost device. Granted, currently I'm only using primitives and 2 textures right now. Maybe I'll throw an X model in there that has some animation and see what the min/res does to that.

I'll throw experimenting on the back burner for now since it only seems to work on XP.

Mage
13
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 20th Feb 2018 01:25 Edited at: 20th Feb 2018 01:25
Since you asked for a solution, minimizing and restoring the app is an obscenely bad solution. Since when has a professional app ever done that. It's bad design.
Just create all the cameras you might need, and use Sync Mask to control if the are rendering on any particular game loop.
That way the app doesn't spaz out on the user and there's no memory leak.
Ortu
DBPro Master
12
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 20th Feb 2018 02:31
i don't believe he was offering that as a solution, but rather wants to determine why it has that effect. Without being able to reproduce though, that will be hard to answer.

In the case of my project specifically, the camera issue is buried deep in Evolved's Advanced Lighting system, I didn't design it that way myself. while I am working on modifying this to not use the delete camera command, it isn't a straight forward task to untangle which is used where, when, and for what. there appears to be a lot of reusing of cameras which relies on delete and remake to to clear and reconfigure for each use.
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 03:31
Quote: "Since you asked for a solution, minimizing and restoring the app is an obscenely bad solution. "


Of course it is, but it does free up memory, leaked and non-leaked (at least on XP).

Quote: "It's bad design.
Just create all the cameras you might need, and use Sync Mask to control if the are rendering on any particular game loop."


The make camera, delete camera snip was just used as an example to show a memory leak, and again in Win XP, it frees that leaked memory with min/res..

The ultimate goal here is to find something that frees the leaked memory like min/res trick does in XP (but for all OSes), that's more graceful than the min/restore trick.

Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 03:52
Another note.

The memory gets freed on the minimize, the restore doesn't seem to do anything special..

So it's something in Minimize that frees the memory, leaked and non-leaked.
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 03:57
Ortu,

Quote: "unfortunately the minimize trick does not work on my windows 10 machines either.
"


Do you lose the device or see anything bad happening when you min/restore?
Ortu
DBPro Master
12
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 20th Feb 2018 05:51
The device is lost of course when the app is set to run as fullscreen exclusive, it is not lost by minimize when running as a window or as full desktop (which is all expected behavior)

In any case, destroying the d3d device by any method does not free the lost camera memory on my machines.
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
James H
13
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 20th Feb 2018 07:59
I haven't noticed any leaks in vram at all, just ram, the cams don't appear to use vram space, I checked both with gpuz and Stab's memory management plugin. I don't think this has anything to do with lost device either - that can only be done like Ortu says, we aren't even using d3d at this point are we? Just 2 cameras and there is no way of resetting cam 0, which is where all the d3d stuff is created - quite sure it used to say this in help files long before they where changed, either that or I got it from here, or maybe the one convention I attended, so the extra cam must not be part of d3d, it's not like cameras are geometry.
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E
zero32
3
Years of Service
User Offline
Joined: 28th Jul 2016
Location:
Posted: 20th Feb 2018 08:33
Do you know about ReactOS ?

I was thinking about testing the bug on a ReactOS virtual machine, because it is open source and we have access to the exact function responsible for the minimize code.
"It is only slightly easier than changing all sugar in a cake into stevia after it has already been baked" -Bisqwit
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 10:02
Quote: "Do you know about ReactOS ?

I was thinking about testing the bug on a ReactOS virtual machine, because it is open source and we have access to the exact function responsible for the minimize code."


Nope.

But I think it has to do more with what Win OS version, more than the minimize code itself.

On XP it works, on Win 10 it doesn't. So there has been some change in the minimize window function between OS versions.

Trying to figure out WHY it works on XP and not on Win 10.

Haven't had any reports on Vista or Win 7 or Win 8.
James H
13
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 20th Feb 2018 10:50 Edited at: 20th Feb 2018 10:59
Quote: "Haven't had any reports on Vista or Win 7 or Win 8."

Um sort of have lol - Win7 64bit...it fails. 32 bit windows shouldn't make a difference as its a 32 bit app in question but never say never. This was actually fixed in U7.5! Scroll down to camera fixes:
Quote: "* Fixed memory leak caused when DELETE CAMERA did not free the data structure within the node"

So now we know what it is at least.

Edit: earlier I mentioned smem command did not work for me - I just noticed in the U7.5 link it takes a parameter not in the help files, the keywords.ini help that shows when you hover over a command even states it takes no parameters looks like I am gonna have to sift through and read every darn change/fix log and test some of them out at some point
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E
Mage
13
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 20th Feb 2018 11:29 Edited at: 20th Feb 2018 11:31
Ortu wrote: "In the case of my project specifically, the camera issue is buried deep in Evolved's Advanced Lighting system, I didn't design it that way myself. while I am working on modifying this to not use the delete camera command, it isn't a straight forward task to untangle which is used where, when, and for what. there appears to be a lot of reusing of cameras which relies on delete and remake to to clear and reconfigure for each use."

I was very mindful of this type of issue when commenting. I have an appreciation for the difficulty you are experiencing there. In some very rare cases it might even be impossible/impractical.

Ortu wrote: "i don't believe he was offering that as a solution, but rather wants to determine why it has that effect. Without being able to reproduce though, that will be hard to answer."

Probably telling you something you already know. There are different kinds of memory leaks. They're all different. As I mentioned above if you get a memory leak loading an AVI file, it's fixed with a completely different method. So be aware you're not going to find a catch all solution.

Zep wrote: "Trying to figure out WHY it works on XP and not on Win 10."

I say this empirically. Windows 10 handles the app window in a more isolated and controlled manner. Later versions of windows draw to what is basically a textured window. The app is like an extra level removed from the hardware. So the app doesn't have the same restrictions or problems when minimized. In the Windows 10 Gamer's update they even made changes to Fullscreen Exclusive mode. It's not quite as exclusive as it once was.
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 11:54 Edited at: 20th Feb 2018 11:58
Quote: "Um sort of have lol - Win7 64bit...it fails. 32 bit windows shouldn't make a difference as its a 32 bit app in question but never say never. This was actually fixed in U7.5! Scroll down to camera fixes:
"


Ah, right right..I forgot

Quote: "Quote: "* Fixed memory leak caused when DELETE CAMERA did not free the data structure within the node"
"


I have both the RC 7 and the 1.0761 installed...the DELETE CAMERA memory leak was not fixed.

Quote: "Edit: earlier I mentioned smem command did not work for me - I just noticed in the U7.5 link it takes a parameter not in the help files, the keywords.ini help that shows when you hover over a command even states it takes no parameters looks like I am gonna have to sift through and read every darn change/fix log and test some of them out at some point "


Interesting, the dmem check is the one that fails for me. Every time I try to check it, dbpro hangs and crashes after a delay.

smem work fine for me with no parameters. (.0761 or 0.77) (win xp)
Mage
13
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 20th Feb 2018 11:57 Edited at: 21st Feb 2018 01:36
Neocatzeo wrote: "I was very mindful of this type of issue when commenting. I have an appreciation for the difficulty you are experiencing there. In some very rare cases it might even be impossible/impractical."

I'm going to walk back from this a bit and say rendering everything in one single sync call can in rare cases be impossible with certain effects. The price being a big performance hit. Simply creating cameras beforehand and using sync mask to control which render should always be possible. This means you can always avoid this memory leak.
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 12:01 Edited at: 20th Feb 2018 12:03
Quote: "I'm going to walk back from this a bit and say rendering everything in one single sync call can in rare cases be impossible with certain effects. The price being a big performance hit. Simply creating cameras beforehand and using sync mask to control which render should always be possible. This means you can always avoid this memory leak."


Ortu is using Advanced Lighting which creates (and deletes) it's own cameras to achieve the shadow technique(s) he desires.
Mage
13
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 20th Feb 2018 12:34
Zep wrote: "Ortu is using Advanced Lighting which creates (and deletes) it's own cameras to achieve the shadow technique(s) he desires."

It would not be a particularly fun task, but it could be modified to not delete any cameras and thus no memory leak.
The highest priority here is solving the problem and this is a way to do that without having odd things like getting the app to relaunch itself and other inane things.

Quick fix or proper fix, it's your choice.
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 12:55
Quote: "Quick fix or proper fix, it's your choice.
"


it's not really.

Something is happening in WIN XP during the minimize command that frees all that leaked memory.

Most everyone seems to be going off track here instead of trying to help/identify what's happening in XP that stopped working in Other OS.

I wish I was smart enough to trace Win XPs MINIMIZE command and why it FREES the memory later OSs don't...but I'm afraid I am not that smart.


Mage
13
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 20th Feb 2018 13:14 Edited at: 20th Feb 2018 13:14
Zep wrote: "Quote: "Quick fix or proper fix, it's your choice.
"
it's not really."

I am under the impression you are looking for some sort of one or two line trick akin to minimizing and restoring the app in a manner that will release a bunch of leaked memory instead of rewriting a section of Advanced Lighting to not create the memory leak to begin with.

Zep wrote: "Most everyone seems to be going off track here instead of trying to help/identify what's happening in XP that stopped working in Other OS."

Windows Vista introduced the desktop window manager, hardware accelerated desktop rendering and as I mentioned they started changing the way app windows are rendered. All later versions of windows inherit these changes and further changes.
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 13:23
Quote: "I am under the impression you are looking for some sort of one or two line trick akin to minimizing and restoring the app in a manner that will release a bunch of leaked memory instead of rewriting a section of Advanced Lighting to not create the memory leak to begin with.
"


Wrong. I am not using Advanced Lighting. I've never heard of it until I found Ortu was using it and then started researching different memory leaks and came up with the min/res trick to free that memory.

Again, you are going off track Mage. it's not any specific thing that leaks memory or WHY it leaks, it's why Win XP will free that leaked memory during a MINIMIZE WINDOW command.

Why is this so hard to understand for you?
Green Gandalf
VIP Member
15
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Feb 2018 14:53
Just seen this thread - and can’t test anything till next week when I return from holiday . I have no intention of going back to XP though so won’t be able to help with that. As others have mentioned, the delete camera leak should have been fixed some time back. I believe it was first noticed in one of the Dark Shader commands which used a temporary camera. So that instance of the problem should be fixed at least. Perhaps you could try a snippet which uses that command (it was something like render dynamic cube map if I recall correctly).
Mage
13
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 20th Feb 2018 15:49
Zep wrote: "Wrong. I am not using Advanced Lighting. I've never heard of it until I found Ortu was using it and then started researching different memory leaks and came up with the min/res trick to free that memory."

You're just playing with words here. You and Ortu as a loosely defined group are looking into this issue.
You have posted under the title "So...Memory Leaks. Help me find a solution!". I have provided a solution to the memory leak. I have offered a further explanation of behavior of Windows.

Zep wrote: "Again, you are going off track Mage. it's not any specific thing that leaks memory or WHY it leaks, it's why Win XP will free that leaked memory during a MINIMIZE WINDOW command.

Why is this so hard to understand for you?"

I have twice offered you an explanation as to why Windows XP has different behavior as you have additionally asked, and you have not acknowledged this.

It's also a bit insulting to have you paint me as incorrect or wrong, when I am the one offering both an answer to your question, and a working stable solution to the larger issue.
Ortu
DBPro Master
12
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 20th Feb 2018 16:21
Easy guys, it's all good.

The patch note for 7.5 is interesting. If it was fixed at one point, it appears to have been broken again later.
http://games.joshkirklin.com/sulium

A single player RPG featuring a branching, player driven storyline of meaningful choices and multiple endings alongside challenging active combat and intelligent AI.
Mage
13
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 20th Feb 2018 16:30
Ortu wrote: "Easy guys, it's all good.

The patch note for 7.5 is interesting. If it was fixed at one point, it appears to have been broken again later."

I completely agree, I'm glad to offer some help. Yes since I tested the latest version of DBP it appears to be a still a bug.
James H
13
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 20th Feb 2018 18:44
Quote: "I have both the RC 7 and the 1.0761 installed...the DELETE CAMERA memory leak was not fixed."

Um you are aware I have said it fails in U7.7rc7 in my first post? I never said it is fixed, I said it was fixed, as per the quote I made of Lee from the U7.5 link I provided. U7.6 only did one thing from what I recall - fairly sure it was related to blitz terrain and nothing else. So as you have said that U7.6 also fails, then it is this one that broke it and U7.7rcX's likely inherited it from that. DMEM was another one that got broke then fixed then broke, I remember it clear enough because even when it did work, it was something would hang the app for a quite while. If you search Stab in the Darks thread history there should be a memory management plugin somewhere, you should be able to use that instead.

Quote: " I'm glad to offer some help"

It is appreciated.
Win 7 Pro 64 bit SP1, AMD A4-5300 APU 3.4GHz, 8GB DDR3, NVidia GeForce GTX 750 1GB GDDR5, ASUS A55BM-E
Green Gandalf
VIP Member
15
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Feb 2018 18:44
The plot thickens . It can be very frustrating being on holiday - but only a bit .
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 21:37
Quote: "I have twice offered you an explanation as to why Windows XP has different behavior as you have additionally asked, and you have not acknowledged this.
"


You haven't. Nothing you posted addresses what is happening n XP as far as freeing the memory. The minimizing of the window could not even be relevant, but some underlying code wrapped up with it.

I recall you mentioning "window is a texture" and "accelerated desktops" in windows 10, yes. None of those explanations were helpful in tracking down the issue.

The memory leaks, on XP I can recover it. On Win 10 you and others can't. This is a fact, not conjecture.

When I have time, I will find something that helps me step through the Windows DLL on minimize and see at exactly what point/command the memory is released. If such a thing is possible, process explorer or one of those utilities perhaps.

Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 21:40
Quote: "Um you are aware I have said it fails in U7.7rc7 in my first post? "


Yes.
Mage
13
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 20th Feb 2018 22:35
Neocatzeo wrote: "I have twice offered you an explanation as to why Windows XP has different behavior as you have additionally asked, and you have not acknowledged this."

Zep wrote: "You haven't."

Yes I did.
Zep wrote: "I recall you mentioning "window is a texture" and "accelerated desktops" in windows 10, yes."

So we agree I did. Vista onward.
Zep wrote: "None of those explanations were helpful in tracking down the issue."

Sorry.

What I was getting at is there is a fundamental change in the way minimized and overlapped windows are handled starting in vista. For example Vista and beyond can render these windows, Windows XP can't. There's an extra DirectX system layer handling things after Windows XP. So you might not have access to what ever low level thing you are tripping in Windows XP to produce the same effect in later versions of Windows. This might not paint a way to the specific thing you are looking for, but explains why there is a change. Helps paint an overall picture of what is going on.
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 23:00
Quote: "So we agree I did. Vista onward."


No. I agree you posted something not relevant.

What does "texture window" and "accelerated desktop" have to do with the make camera, delete camera memory leak and mi/res free that mem (On XP)?

You continue to miss the point. I'd try to pound it into your head a little more but I have broken my hammer trying.
Zep
17
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Feb 2018 23:25
Another idea has struck me. Maybe it is possible it is a DirectX version thing between XP and Other OSes.?

dx9 (for me on XP) compared to what you others have.
Derek Darkly
8
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 21st Feb 2018 00:05 Edited at: 21st Feb 2018 00:08
Quote: "You continue to miss the point. "


LoL.. nice attitude.
Send your parents to noisy sprite demo hell... enter the D-Zone

Login to post a reply

Server time is: 2020-05-28 23:02:15
Your offset time is: 2020-05-28 23:02:15