BBC BASIC for Windows
« Local DIM »

Welcome Guest. Please Login or Register.
Apr 6th, 2018, 12:20am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Local DIM  (Read 395 times)
Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: Local DIM
« Reply #2 on: May 25th, 2013, 1:12pm »

on May 25th, 2013, 07:37am, Richard Russell wrote:
DIM text% LOCAL 255 makes the allocated memory local, i.e. it allocates it from the stack rather than from the heap.


As they both work, and I would assume that they are both acceptable, why would you rather have the memory allocated from the stack? Is there a potential problem, or is just good practice?

Matt
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Local DIM
« Reply #3 on: May 25th, 2013, 5:29pm »

on May 25th, 2013, 1:12pm, Matt wrote:
Is there a potential problem, or is just good practice?

There's a massive potential problem - a memory leak! As a rule you never have a choice of when to allocate memory from the heap or the stack; for example if you're allocating memory inside a PROC or FN it will generally be essential to allocate it from the stack. A memory leak is the very last thing you want because it's so insidious - it may not be noticed until your program eventually crashes maybe days or months later!

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls