July 05, 2007 Set array size to simplify mem mgmt | ||||
---|---|---|---|---|
| ||||
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? |
July 05, 2007 Re: Set array size to simplify mem mgmt | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ald | 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 |
Copyright © 1999-2021 by the D Language Foundation