Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 152
Default Maximum Memory Issue Excel 2003

Hi,
I have a macro that reads in some large text files (to exceed Excel's 65k
line limit).
The macro has a couple of arrays dim'd at 300,000 rows x 57 columns.
Most of the elements are strings so that adds to the size.

I got an Error 7 out of memory issue so I've been running some tests to see
what could be my limitation - see below for test.

I set up the test to redim the arrays in larger and larger incriments to see
what incriments use how much memory. Then I started adding strings to each
element once they were all created.

I get through the redimming and my Excel Memory goes up to about 600+Meg.
After I get into the assigning text to all elements, the CPU utilization
dropps to about 5-15% and the memory drops down to under 30Meg. I find this
very strange because I can stop the macro in vba and look at the "locals"
window and see that the arrays all have the values stored in each element.

So, why does memory show only 30Meg? Or is this really 1030 Meg? And does
the CPU drop because it's now going to the hard drive?

Anyway, just curious.
THanks,
MikeZz

Here's my test Sub:

Dim step, cols, multi, mems

cols = 57
multi = 100000

step = 1
ReDim arr1(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr2(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr3(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal


step = 2
ReDim arr1(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr2(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr3(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal

For r = 1 To multi * step
For c = 1 To cols
arr1(r, c) = "XXxxxxxxxxxxxxXXXXXXXXXX"
Next c
Next r

For r = 1 To multi * step
For c = 1 To cols
arr2(r, c) = "XXxxxxxxxxxxxxXXXXXXXXXX"
Next c
Next r

For r = 1 To multi * step
For c = 1 To cols
arr3(r, c) = "XXxxxxxxxxxxxxXXXXXXXXXX"
Next c
Next r

step = 3
ReDim arr1(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr2(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr3(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Maximum Memory Issue Excel 2003

Check out this link on memory...

http://www.decisionmodels.com/memlimits.htm
--
HTH...

Jim Thomlinson


"MikeZz" wrote:

Hi,
I have a macro that reads in some large text files (to exceed Excel's 65k
line limit).
The macro has a couple of arrays dim'd at 300,000 rows x 57 columns.
Most of the elements are strings so that adds to the size.

I got an Error 7 out of memory issue so I've been running some tests to see
what could be my limitation - see below for test.

I set up the test to redim the arrays in larger and larger incriments to see
what incriments use how much memory. Then I started adding strings to each
element once they were all created.

I get through the redimming and my Excel Memory goes up to about 600+Meg.
After I get into the assigning text to all elements, the CPU utilization
dropps to about 5-15% and the memory drops down to under 30Meg. I find this
very strange because I can stop the macro in vba and look at the "locals"
window and see that the arrays all have the values stored in each element.

So, why does memory show only 30Meg? Or is this really 1030 Meg? And does
the CPU drop because it's now going to the hard drive?

Anyway, just curious.
THanks,
MikeZz

Here's my test Sub:

Dim step, cols, multi, mems

cols = 57
multi = 100000

step = 1
ReDim arr1(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr2(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr3(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal


step = 2
ReDim arr1(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr2(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr3(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal

For r = 1 To multi * step
For c = 1 To cols
arr1(r, c) = "XXxxxxxxxxxxxxXXXXXXXXXX"
Next c
Next r

For r = 1 To multi * step
For c = 1 To cols
arr2(r, c) = "XXxxxxxxxxxxxxXXXXXXXXXX"
Next c
Next r

For r = 1 To multi * step
For c = 1 To cols
arr3(r, c) = "XXxxxxxxxxxxxxXXXXXXXXXX"
Next c
Next r

step = 3
ReDim arr1(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr2(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal
ReDim arr3(1 To multi * step, 1 To cols) As Variant
mems = Application.MemoryTotal

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Maximum Number Of Worksheets In A Work Book-Not A Memory Issue???? Tickfarmer Excel Discussion (Misc queries) 2 December 18th 07 05:05 PM
maximum memory for Excel 2007? Sol[_2_] Excel Discussion (Misc queries) 2 June 16th 07 06:29 PM
Excel.exe memory issue - Resolved in 2007? Sriram Excel Programming 1 September 7th 06 06:31 AM
Excel 2003 memory issue ngenear11 Excel Discussion (Misc queries) 0 May 26th 06 04:28 PM
memory issue using ADO to query Excel Dennis Excel Programming 14 June 23rd 04 04:41 PM


All times are GMT +1. The time now is 01:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"