0 Members and 1 Guest are viewing this topic.
"PTR"→Str0!If Equ►String(<string>,Str0)?-3-Str0.Starts with "PTR"End
Copy(<string>,L₁,3)0→{L₁+3}.Substring at L₁
There are three primary options:Allocate the buffer inside the program with something like Buff(256)→Str0. Note that this will not work if you compile your code as an application, and that Buff( is really the det( token renamed.Allocate the buffer externally by using a free static RAM reference like L1 in place of Str0, or make Str0 refer to the reference, like L1→Str0. As long as you can find the free RAM space for it, this is generally the preferred option. Note that you do not perform any active allocation; the "allocation" simply entails making a note that nothing else should be trying to use that area of RAM at the same time.Allocate the buffer externally by asking the OS to allocate space for the buffer at runtime, like GetCalc("tmpBUF",256)→S. Note that since this is allocated at runtime, you have to save the reference in a variable instead of a static pointer like Str0. This may also fail if the space cannot be allocated due to not having enough free user RAM (in which case S will be zero), a problem which does not affect the other two options. tmp is really the w token (2nd+9), added in Axe 1.2.0, which results in the variable automatically being deleted when your program finishes.
Is there any way to garbage collect in axe? My current program has to archive programs a lot and I want it to automatically garbage collect when necessary (like DoorsCS does).
Also, is there a way to change the size of a program without creating a new program and copying the old?
I think this is done automatically in the "Archive" command. When necessary, the "GarbageCollect ? Yes/No" menu appears. I am not sure though but I think.
This can be done with MEMKIT (included in the zip) if your program is unarchived.