Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Advanced
May 13, 2002



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Save Expensive Heap Allocations

Fixed-size arrays in local variables use a stack-allocated descriptor as expected, but all the data for an array is allocated on the heap. However, fixed-size arrays embedded in structures are fully stack-allocated. This means that you can save yourself expensive heap allocations by defining a (Private) type with a single fixed-size array element and using a UDT-typed variable in place of the local fixed-size array. You can optimize the number of allocations you need to load a standard module or create a class instance using the same technique at module-level.
Matt Curland
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date