digitalmars.D.learn - Set array size to simplify mem mgmt
- Ald <aldarri_s yahoo.com> Jul 05 2007
- Oskar Linde <oskar.lindeREM OVEgmail.com> Jul 05 2007
Hello. I have the following code: char[] unitStack = new char[256]; unitStack.length = 0; Does it make sense from viewpoint of simplifying memory management? If I enlarge the size, the array won't be reallocated?
Jul 05 2007
Ald skrev:Hello. I have the following code: char[] unitStack = new char[256]; unitStack.length = 0; Does it make sense from viewpoint of simplifying memory management? If I enlarge the size, the array won't be reallocated?
That is equivalent to reserving 256 chars. Enlarging the unitStack will not cause reallocation for at least the first 256 entries. -- Oskar
Jul 05 2007








Oskar Linde <oskar.lindeREM OVEgmail.com>