Dynamic Memory Allocation

This is where all discussion of WC3 mapmaking should be held. This forum exists particularly for mapmaking needs. If you have a question on how something works or have need for some code review, this is the place to put it.
Post Reply
Greenspawn
Keeper of the Keys
Posts: 434
Joined: Fri Jan 18, 2008 4:50 pm
Location: Massachusetts

Dynamic Memory Allocation

Post by Greenspawn » Thu Jun 24, 2010 1:19 pm

Is this supported by JASS, and if so, how is it implemented?

For example, I have several arrays that need to handle large amounts of data (reals), but there is no fixed maximum to the numbers of reals I need to store, so I choose to initialize the array with a large amount of available space and hope it's enouth, but this is a bad approach.
Math is # |e^iπ|
"I can't imagine getting hit by a giant rock and not being maimed or crippled or ruined" -Dusk

Logue: Please replace the toilet paper when you use it all. For some reason my 5 year old son believes if it's not there he does not have to wipe.

Soul_Reaver
Revenent of the Replies
Posts: 332
Joined: Thu Feb 14, 2008 3:27 pm
Location: Hungary
Contact:

Re: Dynamic Memory Allocation

Post by Soul_Reaver » Thu Jun 24, 2010 8:44 pm

From my experiences, the game automatically expands the array when you reference a number not initially within it.

User avatar
Fledermaus
Keeper of the Keys
Posts: 354
Joined: Fri Feb 01, 2008 9:55 am
Location: New Zealand
Contact:

Re: Dynamic Memory Allocation

Post by Fledermaus » Fri Jun 25, 2010 6:52 am

In normal jass, the max array size is 8192 but vJass allows big arrays, you have to declare a size though. If you do not know the max size you're going to use, you might want to use a hashtable?

Post Reply

Return to “Custom Map Creation”