Edit 2: fixed code I think.
Here's a hack to resize the internal string buffer, Windows only and needs some assembly. I don't know whether the length of the buffer is set in characters or bytes (which will be important for Unicode) so use at your own risk.
Code: Select all
!extrn _PB_StringBaseSize
!extrn _PB_StringHeap
Define.l string_base
Define.l string_position
Define.l string_heap
Define.l string_size
Gosub GetStringStuff
MessageRequester("Info", "Base=$"+Hex(string_base)+Chr(10)+"Position=$"+Hex(string_position))
foo.s = Space(10000000)
Gosub GetStringStuff
MessageRequester("Info", "Base=$"+Hex(string_base)+Chr(10)+"Position=$"+Hex(string_position))
foo.s = Space(10)
Gosub GetStringStuff
MessageRequester("Info", "Base=$"+Hex(string_base)+Chr(10)+"Position=$"+Hex(string_position))
heap_size.l = HeapSize_(string_heap, 0, string_base)
MessageRequester("Info", "HeapSize="+Str(heap_size))
;- Reset the string size
#HEAP_ZERO_MEMORY = 8
string_base = HeapReAlloc_(string_heap, #HEAP_ZERO_MEMORY, string_base, 16384)
string_size = 16384
EnableASM
mov eax, dword [v_string_base]
mov [_PB_StringBase], eax
mov eax, dword [v_string_size]
mov [_PB_StringBaseSize], eax
DisableASM
Gosub GetStringStuff
heap_size.l = HeapSize_(string_heap, 0, string_base)
MessageRequester("Info", "HeapSize="+Str(heap_size))
; Little test
foo.s = Space(10)+"blah"
MessageRequester("Test", foo)
; Have we knackered something that caches the length of the heap?
foo.s = Space(10000000)
MessageRequester("Test", "If you got here without a crash, hopefully it worked :)")
End
GetStringStuff:
EnableASM
mov eax, dword [_PB_StringBase]
mov [v_string_base], eax
mov eax, dword [_PB_StringBasePosition]
mov [v_string_position], eax
mov eax, dword [_PB_StringHeap]
mov [v_string_heap], eax
mov eax, dword [_PB_StringBaseSize]
mov [v_string_size], eax
DisableASM
Return
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)