René,
I'm stealing some of your HEAP_* great functions to add them as native thinCore functions.
Hope you will not ask me for royalties
Ciao
Eros
Sorry- I had some bug inside - - forgot to exchange some old functions name (HEAP_ArrayFreeAt) inside Function HEAP_DimAt - I had it in there more than once so my spellchecker did not detect it and this only gets called if allocation fails due some lack of memory - so never happened yet...
#MinVersion 1.9.7.0 - Get it here
FileVersion 0.5 19-08-2013
Last edited by ReneMiner; 19-08-2013 at 15:02.
I think there are missing some Forum-sections as beta-testing and support
René,
I'm stealing some of your HEAP_* great functions to add them as native thinCore functions.
Hope you will not ask me for royalties
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Are you kidding me? I feel highly honored
The "Ideas-forum" was a good idea.
PS. this Support-Thread can be marked as "Done" then
Last edited by ReneMiner; 19-08-2013 at 14:36.
I think there are missing some Forum-sections as beta-testing and support
Eros, one question to this:
Is there a formula/ a FAST (!!!) way to retrieve the position where HEAP_Size is stored? Would be interesting to access heap from oxygen without have always to pass the size but just the pointer - If one had to search through a directory-alike list it would be certainly too slow.
Last edited by ReneMiner; 19-08-2013 at 17:42.
I think there are missing some Forum-sections as beta-testing and support
Reneé,
Heap memory is handled directly by the operating system using some KERNEL functions.
More info at: http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
The first thing to do before handling Heap memory blocks is to create a heap handle using HeapCreate or GetProcessHeap functions.
Once you have that handle, you can use HeapAlloc, HeapFree, HeapReAlloc, HeapSize functions.
thinBasic hide all the complexity (at the end it is not so complex) of those functions giving a more comfortable syntax.
I've never used other Heap functions.
But if you read Heap documentation you will see that there are some other functions that can be used to walk though Heap memory blocks: HeapValidate and HeapWalk. More info at:
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
That is all I know.
Ciao
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
I just read there, Heap_Size may contain bogous data? I always assumed if heap x does not exist HEAP_Size(x) would return 0...
I hope at least in tB it works that way...
Do HEAP_Alloc/HEAP_ReAlloc/HEAP_AllocByStr allocate continous data as I thought? Else the overlay stuff is kind'a screwed...
John, it's "Open-to-contribute"
FIX: to insert into function HEAP_DimAt - after
Dword hPtr At vPtr ' -------- ' begin insert If Heap_Size(hPtr) Then Return 0 ' memory already allocated! ' end insert ' ------- Local i As DWord
Last edited by ReneMiner; 19-08-2013 at 20:15.
I think there are missing some Forum-sections as beta-testing and support
I'm up since 6 in the morning already and playing with samples shipped with tB. I've found one that lists equates of all modules. Now I changed it a little making use of some Variables-functions. Now it lists not just equates names but also their values... Found a few that don't get bold.
After running succesful you'll find some .inc-file in program folder.'---Load all modules in order to get all equates Uses "ADO" '<<< have not found this in help-file Uses "BIFF", "BUNDLE" Uses "CGI", "COM", "COMM", "Console", "Crypto" Uses "Dictionary", "DT" Uses "Eval", "EXE" Uses "File", "FileLine", "FTP" Uses "GDIp" Uses "iComplex", "INet", "INI" Uses "LAN", "LL" Uses "MATH", "WinMM" Uses "OnlineScores", "OS", "Oxygen" uses "PC" Uses "RAS", "Registry" ' have not found "RAS" in help neither Uses "SAPI", "SMTP", "Stat" Uses "TBAI", "TBASS", "TBDI", "TBEM", "TBGL", "TCPUDP", "TImage", "Tokenizer"', "Trace"? Uses "UI", "UIAdv" Uses "VBRegExp" Uses "WMI" Uses "XPRINT" Uses "ZLib" #INCLUDE "LazyFun.tBasicU" ' watch it: these equates also listed Dim sKeys As String Dim aKeys() As String Dim nKeys, lVal As Long Dim Count, i, char As Long Dim sOut As String Dim sLine As String Dim sLastPrefix As String '---Get a string with equates separated by $TAB sKeys = APP_ListEquates '---Parse string into an array PARSE sKeys, aKeys, $TAB '---Creates output buffer nKeys = UBOUND(aKeys(1)) For Count = 1 To nKeys sLine = aKeys(Count) If StrLen(sLine) Then If Peek(StrPtr(sLine)) = 37 Then ' % - prefixed If char <> Peek(StrPtr(sLine)+1 ) Then ' new char char = Peek(StrPtr(sLine)+1 ) sOut = sOut + "'[] " + Chr$(char) + $CRLF EndIf For i = 1 To StrLen(sLine) - 1 If Peek(i + StrPtr(sLine)) = 95 Then ' "_" (underscore) If StrLen(sLastPrefix) < i Then sLastPrefix = Memory_Get(StrPtr(sLine), i ) sOut = sOut + "' " + Repeat$(50,"-") + $CRLF Else If Memory_Differs(StrPtr(sLine), StrPtr(sLastPrefix), i ) Then sLastPrefix = Memory_Get(StrPtr(sLine), i ) sOut = sOut + "' " + Repeat$(50,"-") + $CRLF EndIf EndIf Exit For EndIf Next If i >= StrLen(sLine) Then If StrLen(sLastPrefix) Then sOut = sOut + "' " + Repeat$(50,"-") + $CRLF sLastPrefix = "" EndIf EndIf lVal = Peek(Long, VARIABLE_GetPtr(sLine) ) sLine = sLine + Repeat$(50 - StrLen(sLine), " ") + " = &H" + Hex$(lVal, 8) EndIf EndIf PrintL sLine sOut = sOut & sLine & $CRLF NEXT '---Save buffer into .INC file FILE_Save(APP_SourcePath & "EquatesList.inc", sOut) PrintL $CRLF + "Done. Any key to end." WaitKey
Last edited by ReneMiner; 20-08-2013 at 09:02.
I think there are missing some Forum-sections as beta-testing and support
Bookmarks