• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Crash] Likely leak related, assistance needed. Access Violation on Map.

Status
Not open for further replies.
Level 3
Joined
Jul 11, 2013
Messages
38
As the title implies, I'm having an Access violation crash. To those I last spoke, it was probably due to significant leaks in my triggers, since then I THINK I fixed them.

That said, I'm still getting crashes, so it goes to reason I missed something, and as such I require assistance.

... Q_Q PLEAAASE, Its my pet project map.
 

Attachments

  • Eternal Song_1.35.w3x
    17.3 MB · Views: 67
Level 16
Joined
Mar 27, 2011
Messages
1,349
Just played your map. It didn't crash, but the lag was rapidly building up. I think if I played for a little longer, it would have crashed. This lag buildup is probably because of leaks. Looking at your code, I've pulled up a couple of examples.

This:
  • Set PlayerGroupRed = (All allies of Player 1 (Red))
  • Player Group - Pick every player in PlayerGroupRed and do (Actions)
    • Loop - Actions
      • Player - Change color of (Picked player) to Red, Changing color of existing units
      • Custom script: call DestroyForce(udg_PlayerGroupRed)
Should be this instead:

  • Set PlayerGroupRed = (All allies of Player 1 (Red))
  • Player Group - Pick every player in PlayerGroupRed and do (Actions)
    • Loop - Actions
      • Player - Change color of (Picked player) to Red, Changing color of existing units
  • Custom script: call DestroyForce(udg_PlayerGroupRed)
You destroy the force AFTER the force is finished with (not during the usage of the force)


This:
  • Special Effect - Create a special effect at (Position of (Dying unit)) using Objects\Spawnmodels\Demon\DemonLargeDeathExplode\DemonLargeDeathExplode.mdl
  • Wait 2.00 seconds
  • Special Effect - Destroy (Last created special effect)
Should be this instead:

  • Set TempPoint = (Position of (Dying unit))
  • Special Effect - Create a special effect at TempPoint using Objects\Spawnmodels\Demon\DemonLargeDeathExplode\DemonLargeDeathExplode.mdl
  • Custom script: call RemoveLocation (udg_TempPoint)
  • Special Effect - Destroy (Last created special effect)
Whenever a location is used, it will leak. Store the location into a point variable, then remove the variable with a custom script. Also, you cannot use a wait here unless you save the SPX to a variable. This is a little advanced, so I'd rather not explain now.


This:

  • Set Grove = Grove <gen>
  • Unit Group - Pick every unit in (Units in Grove <gen>) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Picked unit)) Equal to Grove Worgen (Black)
          • (Unit-type of (Picked unit)) Equal to Grove Worgen (White)
          • (Unit-type of (Picked unit)) Equal to Valitheria Dreamwalker
        • Then - Actions
          • Unit - Order (Picked unit) to Attack (Attacking unit)
          • Custom script: call RemoveRect(udg_Grove)
        • Else - Actions
Should be this instead:

  • Set Grove = Grove <gen>
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in Grove) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Picked unit)) Equal to Grove Worgen (Black)
          • (Unit-type of (Picked unit)) Equal to Grove Worgen (White)
          • (Unit-type of (Picked unit)) Equal to Valitheria Dreamwalker
        • Then - Actions
          • Unit - Order (Picked unit) to Attack (Attacking unit)
          • Custom script: call RemoveRect(udg_Grove)
        • Else - Actions
You need to clear the Unit Group Leak. Also, not sure why you saved the region into the variable "Grove". Regions do not leak. Locations leak. You May as well have it like this:

  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in Grove <gen>) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Picked unit)) Equal to Grove Worgen (Black)
          • (Unit-type of (Picked unit)) Equal to Grove Worgen (White)
          • (Unit-type of (Picked unit)) Equal to Valitheria Dreamwalker
        • Then - Actions
          • Unit - Order (Picked unit) to Attack (Attacking unit)
        • Else - Actions

There are more leaks, I'll leave it to you to find them.

Edit: Fixed a couple of mistakes in the code
 
Level 3
Joined
Jul 11, 2013
Messages
38
Augh, you're a life saver.

As a sidenote, why does almost everything leak @_@...

I'll get onto making those adjustments...

Also, as for the On Death triggers, can you recommend any alternatives, as a couple of my models for example don't have a proper death animation and need to be sorta removed manually.

I can probably do without the Lightning Orb loot trigger.

Tested it out, kept going alot longer, but still eventually keeled over, I've gone over the tutorials and I'm not sure what I'm missing, let alone what to fix.
 
Last edited by a moderator:
Level 24
Joined
Aug 1, 2013
Messages
4,657
As a sidenote, why does almost everything leak @_@...

Because GUI is not made to make complete maps.
GUI is made to make everyone learn how things work and do minor adjustments on the map.
When you are trying to make an entire game inside WC3, then you should learn JASS instead to have full avaiability of all features that triggers etc offer.

Most things that would be done easier in JASS are still possible in GUI but like these memory leaks, they require some custom script forms... which also makes you learn JASS a bit.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
Also, as for the On Death triggers, can you recommend any alternatives, as a couple of my models for example don't have a proper death animation and need to be sorta removed manually.

What do you mean? Are you talking about the special effects? A lot of special effects will still finish playing the effect, even after being destroyed. Off memory, that SPX in my example 2 should still play after immediately being destroyed. No need to place a wait inside.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Can you show me a map where complete data systems had to be made to make certain things possible and glitchless?
GUI is for everything except REAL shit.
Which is the same statement as "GUI is meant for nothing".

Standard melee initializations are piled up in GUI because everyone has to be able to work with it...
When things are taken to JASS, not everyone understands what to do with it.
And the campaigns arent really that interesting codewise... cmon you are a smart guy.
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
As a sidenote, why does almost everything leak @_@...
It is pretty simple actually.
Let me first explain what is memory leak - most things in WCIII are objects (they have some attributes and some methods linked to it) - all this information for each instance of an object takes some PC's memory (imagine an object as WCIII's "unit" and an instance here is an actual unit in game). Now a memory leak is when such an object has no longer any use to you (the map developer/player) and you lost all reference to this object (simply put there is no way to operate with it anymore). What you end up with is a useless object that persists in the game, taking your PC's memory with it.
Now a lone object doesn't take that much memory, which is why your map gets laggy gradually, as you're building up those leaking objects.

Some programming languages have a so called garbage collector, which automatically removes "unused" stuff. However WCIII simply does not know if you have any more use for that stuff or not. Imagine creating a special effect in some location. You can have two scenarios here:
a) You create the effect as a part of a spell (e.g. fiery explosion for some bomb)
b) You create the effect as part of a map (e.g. moon beam, sunshine, rain, etc.)
Now for option a) the garbage collector could've been of some use - the explosion goes off, then dissipates. Now the object (=special effect) has no use for you, so garbage collector takes care of it.
However what about option b)? Garbage collector could pretty much remove your sunshine even though you want it to persist till the end of the map.

Notice here that you don't need any reference to the effect from case b), because the effect is still useful to you.
So yeah, you need to manually take care of this, because you (as the developer) control the map and what happens there.
 
Level 3
Joined
Jul 11, 2013
Messages
38
Because, I'm an idiot, and my post was still in the wrong section after about a day.
I apologize if this caused frustration and or confusion.

ALSO, I didn't notice the second page of my first post over in the maps forum. I'll just gouge my eyes out with a spoon now.

X_X I'm an idiot.

In loo of this... error between computer and chair. I'd request people stop posting here and I'll try to get this post squared away and the first one moved proper.
 
Status
Not open for further replies.
Top