Search found 48 matches

by fzabkar
Sep 18, 2020 21:34
Forum: Beginners
Topic: Releasing memory from large strings
Replies: 9
Views: 349

Re: Releasing memory from large strings

These are my results :-? Dim sBigString As String Dim lenfil As ULong Dim As Ulong i,j,k lenfil = 100 * 1000 * 1000 i = fre(): print i / (1000 * 1000) sBigString = Space( lenfil ) j = fre(): print j / (1000 * 1000), (i - j) / (1000 * 1000) sBigString = "" k = fre(): print k / (1000 * 1000)...
by fzabkar
Sep 18, 2020 21:13
Forum: Beginners
Topic: Releasing memory from large strings
Replies: 9
Views: 349

Re: Releasing memory from large strings

It does release memory, see: Dim sBigString As String Dim lenfil As ULong lenfil = 100 * 1000 * 1000 print fre() \ (1000 * 1000) sBigString = Space( lenfil ) print fre() \ (1000 * 1000) sBigString = "" print fre() \ (1000 * 1000) Result here: 2990 2890 2989 So, not all memory is released ...
by fzabkar
Sep 18, 2020 20:11
Forum: Beginners
Topic: Releasing memory from large strings
Replies: 9
Views: 349

Releasing memory from large strings

If I initialise a large string as follows (for reading a 100MB file into RAM) ... Dim sBigString As String Dim lenfil As ULong lenfil = 100000000 sBigString = Space( lenfil ) Get #infil, 1, sBigString ... will setting the string to null return its memory to the heap? sBigString = "" Essent...
by fzabkar
Sep 11, 2020 9:22
Forum: Beginners
Topic: Initialising an array with many empty elements
Replies: 15
Views: 593

Re: Initialising an array with many empty elements

Thanks everyone. The define/undefine idea looks the most appealing to me. As for extra files, I prefer to keep everything in the one EXE file, including the usage instructions. This is the present state of the rewrite (before I add the define/undefine edits): http://www.users.on.net/~fzabkar/FreeBas...
by fzabkar
Sep 11, 2020 6:49
Forum: Beginners
Topic: Initialising an array with many empty elements
Replies: 15
Views: 593

Re: Initialising an array with many empty elements

Thanks. Both ideas had occurred to me, but they seemed less appealing than my eventual approach (because I wanted to avoid creating/loading the constants at runtime). I had rejected the following idea: Dim attnam ( 1 To 255 ) As String Dim numatts As UShort = 56 ' there are 56 attributes that need t...
by fzabkar
Sep 10, 2020 22:10
Forum: Beginners
Topic: Initialising an array with many empty elements
Replies: 15
Views: 593

Initialising an array with many empty elements

Is there a less ugly way to initialise an array with many empty elements? (code edited for brevity) I have looked at Enum, Read/Data, and simple assignments of the form sAttnam( n ) = "text_n". Dim sAttnam ( 1 To 255 ) As Const String => _ { _ "Raw Read Error Rate", _ '1 "Th...
by fzabkar
Sep 09, 2020 23:51
Forum: Beginners
Topic: Getting UDTs from the RAM buffer
Replies: 12
Views: 282

Re: Getting UDTs from the RAM buffer

Many thanks. There are quite a few concepts I need to get my head around. At present I'm revisiting my old programs and fixing some of the ugly coding. I'll probably end up writing code that is less efficient, but which I find easiest to comprehend. I expect I'll have a lot more questions along the ...
by fzabkar
Sep 09, 2020 21:19
Forum: Beginners
Topic: Getting UDTs from the RAM buffer
Replies: 12
Views: 282

Re: Getting UDTs from the RAM buffer

Thanks to all. One other annoyance is the way that UDTs handle strings. There are many times when I wish to Get a binary String which contains 0x00 characters. This works OK for String variables on their own, but I have trouble when these Strings (or WStrings or Zstrings) are members of a UDT. Is th...
by fzabkar
Sep 09, 2020 19:08
Forum: Beginners
Topic: Select Case expressions
Replies: 7
Views: 321

Re: Select Case expressions

MrSwiss wrote:
fzabkar wrote:What about this?
More than one 'case' on the same line:

I was wondering whether separate lines, or the numerical order of the constants, affected the optimisation of the jump table.
by fzabkar
Sep 09, 2020 19:01
Forum: Beginners
Topic: Getting UDTs from the RAM buffer
Replies: 12
Views: 282

Re: Getting UDTs from the RAM buffer

ISTM that this task is unnecessarily complicated, even convoluted. By comparison, if I want to Get a UDT using file I/O, I simply specify the UDT variable, and the byte offset within the file. I was hoping that RAM I/O could be done in an analogous way. That is, specify the byte offset in memory usi...
by fzabkar
Sep 09, 2020 6:23
Forum: Beginners
Topic: Getting UDTs from the RAM buffer
Replies: 12
Views: 282

Getting UDTs from the RAM buffer

How do I get the data at filbuff[ n ] into hdr_royl ? Is it as simple as ... hdr_royl = filbuff[ n ] Dim filbuff As Any Ptr Type hdrtyp1 Field = 1 As ULong sig As UByte typ As UByte ignore1 As UShort ignore2 As UShort modid As UShort modsiz As Integer cksm As ULongInt modver End Type Dim hdr_royl As...
by fzabkar
Sep 09, 2020 5:44
Forum: Beginners
Topic: Select Case expressions
Replies: 7
Views: 321

Re: Select Case expressions

What about this? Select Case As Const bfilptr[i] Case 10 Case 32 Case 35 : bfilptr[i] = 59 Case 46 Case 48 To 64 : bfilptr[i] -= 6 Case 65 : bfilptr[i] = 32 Case 66 : bfilptr[i] = 63 Case 99 To 255 : bfilptr[i] -= 5 Case Else : bfilptr[i] -= 9 End Select Is there any reason why I can't put 10, 32, 4...
by fzabkar
Sep 06, 2020 11:32
Forum: Beginners
Topic: Select Case expressions
Replies: 7
Views: 321

Re: Select Case expressions

Many thanks. In fact the same answer occurred to me a couple of minutes ago.
by fzabkar
Sep 06, 2020 10:53
Forum: Beginners
Topic: Select Case expressions
Replies: 7
Views: 321

Select Case expressions

How can I improve the coding of Case Else? I can't seem to find a suitable example in the FB docs, assuming there is one. Dim bfilptr As UByte Ptr Select Case bfilptr[i] Case 48 To 64 : bfilptr[i] -= 6 Case 35 : bfilptr[i] = 59 Case 65 : bfilptr[i] = 32 Case 66 : bfilptr[i] = 63 Case Is > 98 : bfilp...
by fzabkar
Sep 05, 2020 4:21
Forum: Beginners
Topic: Slow printing to console screen
Replies: 14
Views: 480

Re: Slow printing to console screen

If my theory about total screen rewrites has any merit, then I wonder if the difference between my setup and others is that I'm using a VGA connection to my monitor rather than HDMI (because my onboard graphics doesn't have HDMI). Is there anyone who is getting good speeds via VGA?

Go to advanced search