How prevent app to quit

Hi everybody
Im modifying data contain in a big list box by applying regex rules
My listbox have 25 column by 4000 row
When i try to process a complicate regex on all data in a loop… my app quit itself
But if i take one column at the time… it work
I don’t want to process each column one by one
Is there a memory buffer or something is filling up that i can empty in the process
This is one method (regex) to adapt dollar syntax to the language
Takes numbers from a list box and display the regex replace result to another listbox
I wont change my regex formula… just let my app breathe a little bit
Thanks for advice

[code] for o =1 to lbpreview2.ListCount-1
for m = 1 to lbpreview2.ColumnCount-1
contentz = str(lbpreview2.Cell(o,m))

  if contentk =  ComboBoxang.text then
    //cent milles ang
    targetString.text = contentz.Trim
    re = new RegEx
    re.searchPattern = "^([\\d])([\\d])([\\d])([\\d])([\\d])([\\d])$"
    txtcustomregex.Text = re.SearchPattern
    re.replacementPattern = "\\$\\1\\2\\3,\\4\\5\\6"
    txtcustomtarget.Text = re.ReplacementPattern
    targetString.text = re.replace(targetString.text)
    lbpreview2.Cell(o,m) = TargetString.Text
    
  ElseIf contentk =ComboBoxfra.text then
    //cent milles fra
    targetString.text = contentz.Trim
    re = new RegEx
    re.searchPattern = "^([\\d])([\\d])([\\d])([\\d])([\\d])([\\d])$"
    txtcustomregex.Text = re.SearchPattern
    re.replacementPattern = "\\1\\2\\3@\\4\\5\\6@\\$"
    txtcustomtarget.Text = re.ReplacementPattern
    targetString.text = re.replace(targetString.text)
    lbpreview2.Cell(o,m) = TargetString.Text
  end
Next

Nextt[/code]

Is there an error ?

Not on upfront message
But i have a OSX crash report
maybe this extract can guide the search

Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Application Specific Information: *** error for object 0x3081610: pointer being freed was not allocated
Or do you need specific line in that crash report

Can you create a small sharable sample crashing the same way? A click button, process starts and crash.

The entire crash report would help.

A few things. First, you don’t need the square brackets in your patterns.

Second, you can create the RegEx once instead of once for each cell.

Third, why are you using a TextField to store the result for each cell? Do you need that?

Assuming you don’t…

  dim re as new RegEx
  if content = ComboBoxang.text then
    //cent milles ang
    re.searchPattern = "^(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)$"
    re.replacementPattern = "\\$\\1\\2\\3,\\4\\5\\6"
  ElseIf contentk =ComboBoxfra.text then
    //cent milles fra
    re.searchPattern = "^(\\d)(\\d)(\\d)(\\d)(\\d)(\\d)$"
    re.replacementPattern = "\\1\\2\\3@\\4\\5\\6@\\$"
  End If
  txtcustomregex.Text = re.SearchPattern
  txtcustomtarget.Text = re.ReplacementPattern
  
  for o =1 to lbpreview2.ListCount-1
    for m = 1 to lbpreview2.ColumnCount-1
      contentz = str(lbpreview2.Cell(o,m)).Trim
      lbpreview2.Cell(o,m) = re.Replace( contentz )
    Next
  Next

my honnest mistake… Im running it on Real Studio 2012 2.1
Can i post question about old version on that forum ?
Yes Kem your all right… But at this stage i cant afford mess up my code (yes i could… messing it up!!)
But its very appreciate… I’ll correct it soon as this rush batch finished
The forum dont let me post too long message… i delete the Binary image portion
Hope that not the portion you need

[code]Process: Datafixer [6064]
Path: /Users/USER/Desktop/*/Datafixer.app/Contents/MacOS/Datafixer
Identifier: ???
Version: ??? (2.0.0.3.1)
Code Type: X86 (Native)
Parent Process: launchd [143]
User ID: 501

Date/Time: 2014-05-27 14:01:55.742 -0400
OS Version: Mac OS X 10.8.5 (12F45)
Report Version: 10

Interval Since Last Report: 3836954 sec
Crashes Since Last Report: 821
Per-App Interval Since Last Report: 13134 sec
Per-App Crashes Since Last Report: 9
Anonymous UUID: 96175FA2-D551-0704-47E1-9435E051FDC1

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
*** error for object 0x3081610: pointer being freed was not allocated

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x97e8aa6a __pthread_kill + 10
1 libsystem_c.dylib 0x920f8b2f pthread_kill + 101
2 libsystem_c.dylib 0x9212f631 abort + 168
3 libsystem_c.dylib 0x92111e03 free + 428
4 libobjc.A.dylib 0x9239df66 _object_dispose + 68
5 com.apple.AppKit 0x92ebe84b -[NSParagraphStyle dealloc] + 89
6 com.apple.AppKit 0x92df4eb8 -[NSParagraphStyle release] + 207
7 com.apple.CoreFoundation 0x96f0d31b CFRelease + 171
8 com.apple.CoreFoundation 0x9703a693 -[__NSDictionaryM dealloc] + 195
9 libobjc.A.dylib 0x923ac8ff -[NSObject release] + 47
10 libobjc.A.dylib 0x92396442 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 490
11 com.apple.CoreFoundation 0x96f36a63 _CFAutoreleasePoolPop + 51
12 com.apple.Foundation 0x9524c3fd -[NSAutoreleasePool drain] + 122
13 com.apple.AppKit 0x92df568a -[NSApplication run] + 1045
14 rbframework.dylib 0x0069ec93 0x59d000 + 1055891
15 rbframework.dylib 0x00621437 0x59d000 + 541751
16 rbframework.dylib 0x005f24d2 RuntimeRun + 50
17 0x001f67e2 REALbasic._RuntimeRun + 34
18 0x00002ee7 _Main + 245
19 0x00002548 % main + 36
20 0x004f9b48 _start + 116
21 0x004f9a9e start + 43

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0 libsystem_kernel.dylib 0x97e8b9ae kevent + 10
1 libdispatch.dylib 0x94ec1c71 _dispatch_mgr_invoke + 993
2 libdispatch.dylib 0x94ec17a9 _dispatch_mgr_thread + 53

Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x00000000 ebx: 0x00000006 ecx: 0xbffff63c edx: 0x97e8aa6a
edi: 0xac31da28 esi: 0x00000006 ebp: 0xbffff658 esp: 0xbffff63c
ss: 0x00000023 efl: 0x00000206 eip: 0x97e8aa6a cs: 0x0000000b
ds: 0x00000023 es: 0x00000023 fs: 0x00000000 gs: 0x0000000f
cr2: 0x05fa7000
Logical CPU: 0

External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 2
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 4136
thread_create: 1
thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=143.3M resident=71.5M(50%) swapped_out_or_unallocated=71.8M(50%)
Writable regions: Total=872.1M written=775.9M(89%) resident=799.8M(92%) swapped_out=0K(0%) unallocated=72.2M(8%)

REGION TYPE VIRTUAL
=========== =======
ATS (font support) 32.0M
ATS (font support) (reserved) 4K reserved VM address space (unallocated)
CG backing stores 3612K
CG image 88K
CG shared images 1216K
CoreAnimation 4K
CoreServices 1984K
MALLOC 808.5M
MALLOC guard page 48K
Memory tag=240 4K
Memory tag=242 12K
Memory tag=35 6268K
Stack 64.5M
VM_ALLOCATE 16.1M
__DATA 6388K
__DATA/__OBJC 152K
__IMAGE 528K
__LINKEDIT 30.8M
__OBJC 1752K
__OBJC/__DATA 60K
__PAGEZERO 4K
__TEXT 112.5M
__UNICODE 544K
mapped file 108.6M
shared memory 308K
=========== =======
TOTAL 1.2G
TOTAL, minus reserved VM space 1.2G

Model: iMac13,2, BootROM IM131.010A.B05, 4 processors, Intel Core i5, 3.2 GHz, 8 GB, SMC 2.11f14
Graphics: NVIDIA GeForce GTX 675MX, NVIDIA GeForce GTX 675MX, PCIe, 1024 MB
Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54333531533643465238432D50422020
Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54333531533643465238432D50422020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xF4), Broadcom BCM43xx 1.0 (5.106.98.100.17)
Bluetooth: Version 4.1.7f2 12718, 3 service, 21 devices, 3 incoming serial ports
Network Service: Ethernet, Ethernet, en0
Serial ATA Device: APPLE HDD WDC WD10EALX-408EA0, 1 TB
USB Device: Backup+ Desk, 0x0bc2 (Seagate LLC), 0xa0a4, 0x15300000 / 1
USB Device: hub_device, 0x8087 (Intel Corporation), 0x0024, 0x1d100000 / 2
USB Device: DT 101 G2, 0x0930 (Toshiba Corporation), 0x6545, 0x1d110000 / 5
USB Device: hub_device, 0x0424 (SMSC), 0x2412, 0x1d180000 / 3
USB Device: BRCM20702 Hub, 0x0a5c (Broadcom Corp.), 0x4500, 0x1d181000 / 4
USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x828b, 0x1d181300 / 7
USB Device: hub_device, 0x8087 (Intel Corporation), 0x0024, 0x1a100000 / 2
USB Device: Keyboard Hub, apple_vendor_id, 0x1006, 0x1a130000 / 5
USB Device: Logitech USB Optical Mouse, 0x046d (Logitech Inc.), 0xc018, 0x1a131000 / 7
USB Device: Apple Keyboard, apple_vendor_id, 0x0250, 0x1a132000 / 6
USB Device: MT1887, 0x0e8d (MediaTek Inc.), 0x1887, 0x1a120000 / 4
USB Device: FaceTime HD Camera (Built-in), apple_vendor_id, 0x8511, 0x1a110000 / 3[/code]

[quote=92449:@Denis Despres]Can i post question about old version on that forum ?
Yes Kem your all right… But at this stage i cant afford mess up my code (yes i could… messing it up!!)
But its very appreciate… I’ll correct it soon as this rush batch finished
The forum dont let me post too long message… i delete the Binary image portion[/quote]

Yes we talk about all versions, including RS and RB :slight_smile:

Instead of posting to the forum, place the crash dump file for download and use the Link feature to insert that in the post (icon above the text with a globe and a green arrow pointing right).

The problem is, you might be experiencing a bug that has since been fixed by a newer version of Xojo.

this the link to dropbox
link text
The preview seem mess up but the file txt is good
thanks

Just a thought : have you tried to build the app and run it ? Sometimes running in the IDE exhibits strange things and the build app works fine.

I’v run it both way… Same result in RS
BUT Kem As right… If i running it in Debug XOJO… Work fine no crash
The question is… Is it risky to upgrade a project to XOJO
I know its better…enhance…etc etc etc
BUT is there a risk of miss-interpretation between the version
All apps sits on regex loop trough listbox and return to sqlite DB
To final output to tab delimited txt
thanks

[quote=92471:@Denis Despres]I’v run it both way… Same result in RS
BUT Kem As right… If i running it in Debug XOJO… Work fine no crash
The question is… Is it risky to upgrade a project to XOJO
I know its better…enhance…etc etc etc
BUT is there a risk of miss-interpretation between the version
All apps sits on regex loop trough listbox and return to sqlite DB
To final output to tab delimited txt
thanks[/quote]

I had code from 2002. I loaded it in Xojo, let it update deprecated controls (EditField for instance). Now the app is in the Mac App Store and I did not change anything.

Now Regex may have changed but I doubt it.

Unless i process each column at the time… i guess i have no choice
I’ll make a test and compare result of some column… than i jump in XOJO
If it run well at home with IDE… The result may not be worst when i build it at job
Thanks

There really shouldn’t be an issue in running the project in Xojo except if you’ve worked around bugs that no longer exist. (But even that shouldn’t really matter.)

However, you really, really should look at the revised code I offered. I’d expect it to be significantly faster since building up and tearing down an object (in this case, the RegEx object) is computationally expensive.

Sure i will Kem
I took a double check on the code… At the time i’v wrote it … it make sense
But now i admit, it must be improve
Your help (Kem and Michel) is very appreciate
thanks