HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Leaks and memory questions

04-20-2005, 12:37 AM#1
Zandose
Hey, I got some questions about leaks (and yes I've read the tutorials). I've been having problems with my game slowing down after it starts and I'm wondering if it's leaks or me just using a massive amount of game cache. I store 48000 numbers lol. And just in case your wondering why oh why you would need that much, well I just do and don't ask please.

Leaks:

1. Does calling a variable region create a leak?
Code:
Unit - Create 1 Footman for (Player((Integer A))) at (Center of Region[1]) facing Default building facing degrees

2. Does over-writing a variable again and again leak?
Code:
Actions
    For each (Integer A) from 1 to 10, do (Actions)
        Loop - Actions
            Set Integer_i = (Integer_i + 1)

3. Does environment deformations make leaks?
Code:
Environment - Create a 0.01 second Permanent crater deformation at (Center of Z1 <gen>) with radius 1.00 and depth 1.00
Environment - Create a 0.01 second Permanent crater deformation at (Center of Z1 <gen>) with radius 1.00 and depth 1.00

4. Does calling game cache leave any leaks?


Memory:

5. Does variables store its information in active memory?


6. Does game cache store its information in active memory?


Just here for refrence.
Quote:
call DestroyTextTagBJ( GetLastCreatedTextTag() )

call DestroyLeaderboardBJ( GetLastCreatedLeaderboard() )

call DestroyMultiboard( GetLastCreatedMultiboard() )

call DestroyQuest( GetLastCreatedQuestBJ() )

call DestroyEffectBJ( GetLastCreatedEffectBJ() )

call DestroyLightningBJ( GetLastCreatedLightningBJ() )

call DestroyGroup( GetLastCreatedGroup() )

call DestroyFogModifier( GetLastCreatedFogModifier() )

call RemoveDestructable( GetLastCreatedDestructable() )

call RemoveItem( GetLastCreatedItem() )

call RemoveLocation( GetRectCenter(GetPlayableMapRect()) )

call RemoveRect( GetCurrentCameraBoundsMapRectBJ() )

call RemoveRegion( GetTriggeringRegion() )

call RemoveUnit( GetTriggerUnit() )

call KillSoundWhenDoneBJ( GetLastPlayedSound() )

call DestroyTrigger( GetTriggeringTrigger() )
04-20-2005, 01:04 AM#2
TheNyne
1. Not to my knowlege.
2. Depends on the type of variable, but for an integer/real, no.
3. I haven't checked lately, but isn't there a way to destroy terrain deformations. If so, they do but they have a GUI trigger to solve it.
4. Couldn't tell you, I wouldn't think so, but you never know.
5 & 6. I'm not too sure what active memory is, but most things in WE is dependant on specificly what it is. So by my experiences, for some things - yes, others no.
04-20-2005, 02:35 AM#3
Raptor--
Quote:
Originally Posted by Zandose
Hey, I got some questions about leaks (and yes I've read the tutorials). I've been having problems with my game slowing down after it starts and I'm wondering if it's leaks or me just using a massive amount of game cache. I store 48000 numbers lol. And just in case your wondering why oh why you would need that much, well I just do and don't ask please.

Leaks:

1. Does calling a variable region create a leak?
Code:
Unit - Create 1 Footman for (Player((Integer A))) at (Center of Region[1]) facing Default building facing degrees

Center of Region[1] is a point (location) thats created and not destroyed

Quote:
Originally Posted by Zandose
2. Does over-writing a variable again and again leak?
Code:
Actions
    For each (Integer A) from 1 to 10, do (Actions)
        Loop - Actions
            Set Integer_i = (Integer_i + 1)

primative data types do not cause memory leaks, its only when pointer data gets overwritten before the reference is deleted that a memory leak occurs

Quote:
Originally Posted by Zandose
3. Does environment deformations make leaks?
Code:
Environment - Create a 0.01 second Permanent crater deformation at (Center of Z1 <gen>) with radius 1.00 and depth 1.00
Environment - Create a 0.01 second Permanent crater deformation at (Center of Z1 <gen>) with radius 1.00 and depth 1.00

Center of Z1 is a point (location) thats created and never destroyed

Quote:
Originally Posted by Zandose
4. Does calling game cache leave any leaks?

no, why would it?

Quote:
Originally Posted by Zandose
Memory:

5. Does variables store its information in active memory?


6. Does game cache store its information in active memory?


Just here for refrence.

variables are in active memory obviously, and afaik, gamecache is also in active memory until you 'save game cache' which you don't do since its multiplayer
04-20-2005, 02:37 AM#4
Zandose
Thank you. That really helps. but do you think 48000 variables/game cache would use up to much memory?
04-20-2005, 02:42 AM#5
Raptor--
Quote:
Originally Posted by Zandose
Thank you. That really helps. but do you think 48000 variables/game cache would use up to much memory?

umm, an integer/reference is usually 16 bits right? which is 2 bytes, * 48000 is roughly...
0.09 of a megabyte, or 93kb
i have 1024mb ram so i think i'd be ok with that

then again i don't know how warcraft works with memory, just a guess
04-20-2005, 03:30 AM#6
Zandose
I see. So I should be fairly safe. The only problem I'm having now a days is leaks. But I should be able to fix them now.
04-20-2005, 11:50 PM#7
Zandose
How do I remove a point? I can find the remove trigger but I don't see anything for like "Last created point".
04-21-2005, 04:50 AM#8
TheNyne
Points, are usually set by variables. You can't create a point, only determine a variable to a point. And I'm sure exactly, but I'm 98% sure that it is:

call RemoveLocation(variable)

Someone correct me if I'm wrong though.
04-21-2005, 07:22 AM#9
Raptor--
umm... i'm gonna quote you, since you've already stated what to use yourself

Quote:
Originally Posted by Zandose
Just here for refrence.

call RemoveLocation( GetRectCenter(GetPlayableMapRect()) )
04-21-2005, 08:19 AM#10
Anitarf
As far as I know there is no "last created point", so there's no way to reference any point object you create, unless you create it by setting a variable to it. So, for example, if you use the following line:

Set TempPoint = (position of (triggering unit))

...then you'll have a variable pointing to your point object and you'll be able to use this variable to destroy the object after you no longer need it with this function:

Custom script: call RemoveLocation( udg_TempPoint )