Jump to content
Sign in to follow this  

Quick spec questions & app silent crash

Recommended Posts


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 used

  • FileOpen 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 megs


Share this post

Link to post
Share on other sites

#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>


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, _
_GUICtrlRichEdit_AppendText($hRichEdit, FileRead("test.txt"))

While True
$iMsg = GUIGetMsg()
_GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes
;~ GUIDelete() ; is OK too
EndFunc ;==>Main

Change FileRead("test.txt"): "test.txt" to your file name

Not sure if this is exactly what you want

Edited by GordonFreeman

Share this post

Link to post
Share on other sites

Thanks for the code. which I have. My query is about memory limits of AutoIT for


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..

Share this post

Link to post
Share on other sites


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. ;)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites

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).

Share this post

Link to post
Share on other sites

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)

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this