icuurd12b42 Posted December 28, 2012 Posted December 28, 2012 I compiled a script that sends a file to a richedit the file content but the app simply exites silently when my file was just a few MB large.So I have a few questions about the things invoved that I usedFileOpen Any mem/disk size limit?FileRead Same, Size limit? how about the variable that holds it? 2GB?local $txt =FileRead($hfile) - local $txt: Size limit for 32bit? Size limit for 64 bit?global $gtxt =FileRead($hfile) - local $gtxt: Size limit for 32bit? Size limit for 64 bit?richedit Size limit to add, to set, to insert, to whole content?local $arr[N] - N limit? arr[] limit (mem)?global $garr[N] - N limit? garr[] limit (mem)?Can Compile Script to exe compile to 64 bits? even if the compiler is 32 bits?To fix the crash I read the file line by line. but I cannot keep the whole file in memory, $filebuff += ReadLine()... crash at about 1.5 megsThanks!
GordonFreeman Posted December 28, 2012 Posted December 28, 2012 (edited) #include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Main() Func Main() Local $hGui, $hRichEdit, $iMsg $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) _GUICtrlRichEdit_AppendText($hRichEdit, FileRead("test.txt")) GUISetState() While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes ;~ GUIDelete() ; is OK too Exit EndSelect WEnd EndFunc ;==>Main Change FileRead("test.txt"): "test.txt" to your file name Not sure if this is exactly what you want Edited December 28, 2012 by GordonFreeman Frabjous Installation
icuurd12b42 Posted December 29, 2012 Author Posted December 29, 2012 Thanks for the code. which I have. My query is about memory limits of AutoIT for FileRead("test.txt") as per the help A file can be read as binary (byte) data by using FileOpen with the binary flag - in this case count is in bytes rather than characters. A count value that is too large can lead to AutoIt stopping with a memory allocation failure. I want to know if I'm going to cap my file reading, Which I did, but what size is the size cap size??? How much can I allocate if I decided to hold records in memory? couljd I hold 100000 text messages in an array? 100000*256 bytes. In an array? Or even in the rtf richedit box? what are the limits? does anyone know? Each instances ov the program running would need 24MB allocated in a records[100000] array..
Moderators Melba23 Posted December 29, 2012 Moderators Posted December 29, 2012 icuurd12b42, Look in the Help file <AutoIt - FAQ> for the technical limits. But if you are really looking for 24MB arrays, I suggest you go and look at some form of database as trying to manipulate any data array that size is never going to work. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
icuurd12b42 Posted December 30, 2012 Author Posted December 30, 2012 25 Megs is still perfectly reasonable in some cases. I was just wondering if AutiIT had a limit of it's own for arrays. I'll check the faq. I changed my method to be more streamlined. I am paging by recordset right now, I would rather not to have to page the rtf document data (the record layout).
icuurd12b42 Posted January 7, 2013 Author Posted January 7, 2013 My final implementation loads the record sets in a global string one (256byte) record at a time, bypassing the fileread maximum. I also have 8 arrays of 1000 in size to keep the records in memory (name, text, date, etc). Then I pass the string to the Rich Edit, making sure to re-adjust the rich edit data size maximum (default 32k) to match the final string size. I did limit the number of records to 1000 items (* 256 for size), as showing more than that in the rich edit is really not needed (too large a document), the rich edit formats the records in a click-able list fashion. I can safely load 1000 records of 256 byte in arrays, stuff the array in a formatted rtf buffer and send it to the rich edit. total memory size ~1000k (arrays + buffer+copy of buffer in rich edit)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now