"TRIGSTR_1320" ? (Advanced JASSers plz)

Cohadar

master of fugue
Reaction score
209
When I convert triggers from GUI to JASS strings I use in them
are converted to "TRIGSTR_1320" and stuff like that.

Now I know WE stores them in some internal table so he can reuse them later
My question is where can I find this table?

Also if I use strings in JASS directly, like this one:

DisplayTextToPlayer(player, x, y, "hello world")

will this create a leak?

I think it will this is a local string variable after all.

So I was thinking to use something like

globals
string msg1 = "njak"
endglobals

for all my string.

am I being a "leak-freak" here?
 

Cohadar

master of fugue
Reaction score
209
I consider myself to be a good JASSer also,
it is only that now I need advice from someone better.

Download the map and see for yourself how strings leak.

Strings are Objects, they are NOT native types like integer and real.
therefore they can leak.
 

SFilip

Gone but not forgotten
Reaction score
634
Strings...well they don't exactly leak, but...keep reading.
TRIGSTR_1320 is a location in the game's string table. Every string used in warcraft is added to this table so that you can use it again afterwards.
Using the same string twice is not a leak as it already exists in the table. But using another would require more memory allocated and warcraft usually doesn't clean this up like some other programming languages.
Now war3map.wts is just the stuff preloaded into the table, it gets copied into the RAM while the map is loading.
Either way those leaks are no big deal and there is no way to fix them anyway.

And as a side note: Task Manager is NOT a good nor precise way of monitoring leaks.
The information you can get when using it is statistical at best.
 

Cohadar

master of fugue
Reaction score
209
And as a side note: Task Manager is NOT a good nor precise way of monitoring leaks.
The information you can get when using it is statistical at best.

I know, but on a simple test map when you see war3 eat 5mb per sec
it is a damn statistical guess :rolleyes:
 

--Thanatos--

New Member
Reaction score
33
Yes. Task Manager is a program where we can see Wc3 consume memories on empty map. :rolleyes:

Strings, are the the Integer and Real's friends. Try to check out the common.j.
 

Cohadar

master of fugue
Reaction score
209
Yes. Task Manager is a program where we can see Wc3 consume memories on empty map. :rolleyes:

Strings, are the the Integer and Real's friends. Try to check out the common.j.

I am fully aware of how wc3 uses memory,
but still, dynamically created strings eat memory.

And string are NOT Integer and Real's "friens"
they never were, and they never will be.

Strings "appear" like native types because JASS makes them that
way so it would be easier to use them.
(so do Java, C# and even C++)

But Strings are Objects (with variable size)
they can be created like objects,
and in C/C++ they can also be destroyed.

Just because JASS does not have a Destroy function for them
does not make them native types.

------------------

Anyway, dynamic strings do leak
(but very small amounts of memory compared to other objects in JASS)
so it is not a big deal after all.

EDIT:
I think there is one more thing that needs to be said

I am sorry about my above comment --Thanatos--
it wasn't meant to insult you.

JASS is a very simple language and fairly intelligent person can learn it in a couple of days
but because of all the limits and other "troubled" staff,
(basically Blizzards shitty design of it)
it seems that it is more important to have a lot of experience with it
no matter how much of programming you know at the moment
so you would know where are pitfalls and how to avoid them
 
A

Aw2k6

Guest
I know, but on a simple test map when you see war3 eat 5mb per sec
it is a damn statistical guess :rolleyes:

Just to add to the conversation, 5mb per sec is completely off. It's 5kb per sec. -.- 1,000 times difference is quite a bit.
 

SFilip

Gone but not forgotten
Reaction score
634
> when you see war3 eat 5mb per sec
Doesn't mean anything really.
Task manager displays memory even if it's unallocated in the game's terms (for example: when you destroy a trigger the memory it occupied will not be available for other applications; instead, some other trigger will take it's place).
Not to mention that you can't separate the memory user allocated from the one engine itself did.

> dynamic strings
Ever had the need for this in an actual map?
I mean, in quantities high enough to actually matter?
 

SFilip

Gone but not forgotten
Reaction score
634
TRIGSTR_whatever might work slightly faster when compared to using a normal string (but only for the first time) - as I already said, the wts file is cached while the map is loading. A map that has more TRIGSTRs can get it's loading time increased. Typing a string directly doesn't cache anything until you actually use it - until the trigger where you typed it is ran.
All in all typing strings directly is not only easier for you to read, but can also be better when it comes to your map's loading time. They don't leak anymore than TRIGSTRs do and there is no difference in the amount of memory used.
Also Vexorian's Optimizer inlines all TRIGSTRs with actual strings by default.
 

SerraAvenger

Cuz I can
Reaction score
234
Strings...well they don't exactly leak, but...keep reading.
TRIGSTR_1320 is a location in the game's string table. Every string used in warcraft is added to this table so that you can use it again afterwards.
Using the same string twice is not a leak as it already exists in the table. But using another would require more memory allocated and warcraft usually doesn't clean this up like some other programming languages.
Now war3map.wts is just the stuff preloaded into the table, it gets copied into the RAM while the map is loading.
Either way those leaks are no big deal and there is no way to fix them anyway.
Here is what I know about this subject. I wouldn't bet my head on it, but afaik they are all true:


>TRIGSTR_1320 is a location in the game's string table

1.: It is a pointer pointing to the data, not a location

>Every string used in warcraft is added to this table so that you can use it again afterwards.
Using the same string twice is not a leak as it already exists in the table.

2.: Not every string used is really added to that table. It are the strings to which pointers are assigned ( mostly done by warcraft while using the graphical user interface )

>Using the same string twice is not a leak as it already exists in the table.

Depends wether you use the string the pointer points to or a string wich has the same content and cannot be distinguished from the first one. In the first case, the code won't have a leak. In the second case, it will.

>[...] more memory allocated and warcraft usually doesn't clean this up like some other programming languages.

For luck JASS doesn't have a garbage collector. Much of the code you use would no longer work, you would need pointers to everything you use including: Texttags, effects, any local things and so on, in total everything that get's no pointer pointing to it by the code handling it would be destroyed ...

>Either way those leaks are no big deal and there is no way to fix them anyway.

Clearing the memory leaks would need more memory than just letting them be xD

Greetings Serra
 

Tom Jones

N/A
Reaction score
437
Depends wether you use the string the pointer points to or a string wich has the same content and cannot be distinguished from the first one. In the first case, the code won't have a leak. In the second case, it will.

Greetings Serra
Nope, two strings containing "Bob" will have the same handle id.
 

SFilip

Gone but not forgotten
Reaction score
634
> It is a pointer
I disagree.
A general definition of a pointer in programming would be an actual address in the memory which strings, by all means, aren't. In addition two strings that are the same have the same id which is something that can never (and mustn't) happen when it comes to pointers.

> the strings to which pointers are assigned ( mostly done by warcraft while using the graphical user interface )
No, we aren't talking about the same thing.
You are talking about the wts file, a list of stuff to preload to the actual cache. Yes, it does contain some UI stuff like the map name, description etc.
But I'm talking about the cache, located in the memory while the map is being played, where all used strings are.
 

--Thanatos--

New Member
Reaction score
33
Meh.

I know Strings do leak, but.. that much? Really, it's a natural leak, and not that big.

Ok, I know that I'm wrong in the part I say "Strings are integer and real's friend".

I almost forgotten about those. -.-
 

Sim

Forum Administrator
Staff member
Reaction score
534
will this create a leak?

I think it will this is a local string variable after all.

A short conclusion would look like this:

The leak is too small to worry about, and it's not like you could fix it anyway.
 

Cohadar

master of fugue
Reaction score
209
> dynamic strings
Ever had the need for this in an actual map?
I mean, in quantities high enough to actually matter?

See that is the point exactly, I really do.

I have a big multiboard with lots of player statistics,
player revival time, and a game timer
and they constantly change (i.e. use dynamic strings)

it is currently eating 50mb per one hour game,
and it does not free that memory up afterwards :(
It's really pissing me off.
 

SFilip

Gone but not forgotten
Reaction score
634
> it is currently eating 50mb per one hour game
> and it does not free that memory up afterwards
Task Manager again?
Once again: don't trust it when it comes to memory leaks.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top