Documentations - SRON
  • SRON's Official Documentation
  • Installation
  • Syntax of SRON
  • Executing a SRON code
  • Keywords in SRON
  • Comments in SRON
  • Datatypes in SRON
  • Variables in SRON
  • Memory Ownership Model
  • Operators in SRON
  • Math block
  • if elif else in SRON
  • Loops in SRON
    • For Loop
    • While Loop
    • Foreach Loop
  • Break & Continue
  • Functions in SRON
    • Print functions
    • User Input Functions
    • Type Conversion functions
    • Type Checking functions
    • Math functions
    • Char Functions
    • String Functions
    • List Functions
    • Miscellaneous functions
  • Return in SRON
  • Command Line Arguments
  • Free
  • Rotate
  • Console
  • Sample codes
  • Coding Convention
  • Frequently Asked Questions
  • Credits
  • Contact
  • Donate
Powered by GitBook
On this page

Free

SRON provides runtime memory management using 'free' attribute. 'free' allows you to deallocate a variable's memory space.

NOTE: After the variable is freed, it cannot be accessed anymore. But the memory will still be available to other variables if they own the same memory block.

Syntax:

    free : variable_name

Example:

{
    name : MAIN

    Int val = 27

    println(val)

    free : val

    println(val)
}

OUTPUT:

27

In 'MAIN.srb':
VariableNotFoundException Caught :
||>> While retreving the value of a variable.

    > Reason 1: Specified Variable not found !
    > Reason 2: Specified variable is freed up before.       

    ||> Solution: Input a valid variable that already exists.

NOTE: Use it wisely because if you try to access a variable after it was freed, then your program will suddenly exit with code 1.

PreviousCommand Line ArgumentsNextRotate

Last updated 6 months ago