English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 01 November 2022, 16:24   #1
AmiNju
Registered User
 
Join Date: Mar 2020
Location: Duesseldorf / Germany
Posts: 36
AmiBlitz3: Dim and FreeMem

Hello,
in a loop I Dim a array like

Code:
Dim filebuffer.b(Lof(0))
Lof = Get filesize of a given file

After some calculations I want to free this initialized memory, because after some loop iterations I get at this point a "Out of memory".

My idea was to use


Code:
FreeMem &filebuffer(0), Lof(0)
But now I get at the first code (DIM filebuffer....) the error message "Unable to Free Memory (Hint: program overide illegal"


What is the best practice to free the memory after used a array?
AmiNju is offline  
Old 01 November 2022, 20:35   #2
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,352
I don't think arrays that have been dimmed can be freed (or, indeed, standard variables). They are only disposed of when the program ends. The main alternative I can see is to allocate a block of RAM and access it directly, then free it afterwards.
Daedalus is offline  
Old 01 November 2022, 20:46   #3
AmiNju
Registered User
 
Join Date: Mar 2020
Location: Duesseldorf / Germany
Posts: 36
Quote:
Originally Posted by Daedalus View Post
I don't think arrays that have been dimmed can be freed (or, indeed, standard variables). They are only disposed of when the program ends. The main alternative I can see is to allocate a block of RAM and access it directly, then free it afterwards.

I found a solution suggest by you in another thread. I use Bank-methods to solve this/my problem. I don't feel ready to work safely with pointers and address locations yet.


But thank you very much! I've learned so much today (by you)!
AmiNju is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dark/Dim Image from A1200 amifan support.Hardware 1 04 March 2021 06:34
[blitz] re-dim arrays inside statement/function peceha Coders. Blitz Basic 7 24 June 2020 13:10
FreeMem partial blocks? Keir Coders. System 25 29 January 2019 23:54
Blitz help with Dim gazj82 Coders. Blitz Basic 12 28 September 2017 17:47
A2000 with Picasso II, screen is dim LuigiThirty support.Hardware 1 16 August 2017 07:33

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:52.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.06447 seconds with 15 queries