Pseudodynamic memory manager

xPheRe

New Member
Reaction score
43
Hi! I'm new posting in the forum, but I have learned all about WE reading posts here and with some "try and error". I coded some JASS and decide to send it. Maybe it can help anyone. Maybe not. I've only coded it as a coding exercise.

It is a pseudodynamic memory manager, it's able to alloc and release chunks of data at runtime. Maybe it's similar to the HeapGet of WEU, in the sense that uses a huge array to store data, but I think it's more powerful, fast and versatile. It's easily modifiable to allow other kind of storage, like a bunch of arrays or gamecaches, whatever.

In the example the wisps allocates and deallocates random sized blocks of random data. If you click a wisp with linked data, it will tell you what data carries.

Hope someone finds it usefull, and hope to send some maps and campaings soon too.

Thanks to all!

(Edit: Link to the old attachment here)
 
:eek:

Possible error:
Code:
// Sets the data of a block from BEGIN to END, both included, to value VALUE
function xClear takes integer begin, integer end, integer value returns nothing
    local integer it = begin
    loop
        exitwhen it == end

        call xSet(it, value)
        set it = it + 1
    endloop
endfunction
It doesnt set udg_zzz_Memory[end] = vaule it quit before it sets
 
thid should go in the free codes thread, its a stcky at the top.
 
phyrex1an said:
It doesnt set udg_zzz_Memory[end] = vaule it quit before it sets
Yes, that's right. The comment at the top of the function is OK but the code is wrong. The line "exitwhen it == end" should be "exitwhen it > end" :banghead:

I haven't tested the code a lot, so this minor bug passed me by. Thanks!

AgentPaper said:
thid should go in the free codes thread, its a stcky at the top.
The truth is that I didn't know where to post it :confused: And it would be GREAT if it's sticky, thx :) :) :) :)

Here's a corrected version without the xClear bug
Soon I hope to add some features like reallocation and a linked list system based on this one (like WEU has)
 
I would be interested in knowing if anybody finds this useful and for what kind of stuff :)
If it's not... well, at least it was a great coding exercise :D
 
Im_On_56k said:
Simply go into that thread and post your map, jass code there.
It is allredy there ^^

xPheRe said:
I would be interested in knowing if anybody finds this useful and for what kind of stuff :)
If it's not... well, at least it was a great coding exercise :D

This should be VERY usefull, if it wasnt fore one thing: The return bug (not a bug in your code), the return bug and a game cache allredy do this and without an array and with a very short code. It is able to store units as well.

Check it out: http://www.wc3jass.com/viewtopic.php?t=224 (Local Handle Variables)

Your code has one advantage, it doesnt leak if a unit dies. The Local Handle Variables does if the unit isnt "cleaned".

One thing it still is usefull for is: Make me better at programming^^
 
I thought the "Free trigger code" thread was for short snippets of code/triggers, so I wrote a post with a simple func to shufle the content of an array.
Anyhow, There's any way to move the first post of this thread to the "Free trigger code" thread?
Thx for all, phyrex1an, Im_On_56k, if there's a way I can help, you only have to mention it ;)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top