|
#1
|
|||
|
|||
|
Using huge arrays in VB
I am developing a real-time application in VB that executes a time critical control loop in approximately 5 ms. My problem is how to store the data that is gathered on the system during each pass. I want to store about 80 real values every 5 ms and so I think I need to store the data in an array (because of the time factor) and that figures out to about 3.7 Mb/min of data. I have tried declaring an array explicitly of about 50 Mb, but my call to GlobalMemoryStatus shows almost all of my 128 Mb of ram used before I even run my VB application. I have no other processes running and I don't believe the background windows processes are taking up all that memory. Could someone help me with understanding both of my problems, 1. Why is some much of my ram used, and 2. Is an array of that size possible in VB and is there any trick in declaring/using it? Thanks, I'm stumped on this one. |
|
#2
|
|||
|
|||
|
Re: Using huge arrays in VB
Hi Bruce --
Can be done, but only within some limits. 50Mb shouldn't be impossible, though it'll probably be shuffling off to disk unless you have a *lot* of RAM. You might consider using memory-mapped files, rather than an array. Take a look at the MemMap.zip sample on my site, for a class-wrapper. How long do you need to sustain this sort of data collection? Later... Karl -- http://www.mvps.org/vb "Bruce McFall" <bruce.mcfall@ae.ge.com> wrote in message news:3a71c0ec$1@news.devx.com... > > > I am developing a real-time application in VB that executes a time critical > control loop in approximately 5 ms. My problem is how to store the data that > is gathered on the system during each pass. I want to store about 80 real > values every 5 ms and so I think I need to store the data in an array (because > of the time factor) and that figures out to about 3.7 Mb/min of data. I have > tried declaring an array explicitly of about 50 Mb, but my call to GlobalMemoryStatus > shows almost all of my 128 Mb of ram used before I even run my VB application. > I have no other processes running and I don't believe the background windows > processes are taking up all that memory. Could someone help me with understanding > both of my problems, 1. Why is some much of my ram used, and 2. Is an array > of that size possible in VB and is there any trick in declaring/using it? > Thanks, I'm stumped on this one. |
|
#3
|
|||
|
|||
|
Re: Using huge arrays in VB
Hi Karl, I need to sustain that rate for at most 10 min. or so. Longer if possible. I am hoping that the 128 Megs that my machine has will do.. Memory mapped files sound good. Hopefully easy to use. Thanks for the help.. Enjoyed your site. "Karl E. Peterson" <karl@mvps.org> wrote: >Hi Bruce -- > >Can be done, but only within some limits. 50Mb shouldn't be impossible, though it'll >probably be shuffling off to disk unless you have a *lot* of RAM. You might consider >using memory-mapped files, rather than an array. Take a look at the MemMap.zip >sample on my site, for a class-wrapper. How long do you need to sustain this sort of >data collection? > >Later... Karl >-- >http://www.mvps.org/vb > > > >"Bruce McFall" <bruce.mcfall@ae.ge.com> wrote in message >news:3a71c0ec$1@news.devx.com... >> >> >> I am developing a real-time application in VB that executes a time critical >> control loop in approximately 5 ms. My problem is how to store the data that >> is gathered on the system during each pass. I want to store about 80 real >> values every 5 ms and so I think I need to store the data in an array (because >> of the time factor) and that figures out to about 3.7 Mb/min of data. I have >> tried declaring an array explicitly of about 50 Mb, but my call to >GlobalMemoryStatus >> shows almost all of my 128 Mb of ram used before I even run my VB application. >> I have no other processes running and I don't believe the background windows >> processes are taking up all that memory. Could someone help me with understanding >> both of my problems, 1. Why is some much of my ram used, and 2. Is an array >> of that size possible in VB and is there any trick in declaring/using it? >> Thanks, I'm stumped on this one. > |
|
#4
|
|||
|
|||
|
Re: Using huge arrays in VB
Hi Bruce --
If you can allocate the "worst-case" scenario before beginning the collection, MMFs oughta do ya just fine! They're extremely quick. Good luck... Karl -- http://www.mvps.org/vb "Bruce McFall" <bruce.mcfall@ae.ge.com> wrote in message news:3a71ce19$1@news.devx.com... > > > Hi Karl, > I need to sustain that rate for at most 10 min. or so. > Longer if possible. I am hoping that the 128 Megs that > my machine has will do.. Memory mapped files sound good. > Hopefully easy to use. Thanks for the help.. Enjoyed your > site. > > > "Karl E. Peterson" <karl@mvps.org> wrote: > >Hi Bruce -- > > > >Can be done, but only within some limits. 50Mb shouldn't be impossible, > though it'll > >probably be shuffling off to disk unless you have a *lot* of RAM. You might > consider > >using memory-mapped files, rather than an array. Take a look at the MemMap.zip > >sample on my site, for a class-wrapper. How long do you need to sustain > this sort of > >data collection? > > > >Later... Karl > >-- > >http://www.mvps.org/vb > > > > > > > >"Bruce McFall" <bruce.mcfall@ae.ge.com> wrote in message > >news:3a71c0ec$1@news.devx.com... > >> > >> > >> I am developing a real-time application in VB that executes a time critical > >> control loop in approximately 5 ms. My problem is how to store the data > that > >> is gathered on the system during each pass. I want to store about 80 real > >> values every 5 ms and so I think I need to store the data in an array > (because > >> of the time factor) and that figures out to about 3.7 Mb/min of data. > I have > >> tried declaring an array explicitly of about 50 Mb, but my call to > >GlobalMemoryStatus > >> shows almost all of my 128 Mb of ram used before I even run my VB application. > >> I have no other processes running and I don't believe the background windows > >> processes are taking up all that memory. Could someone help me with understanding > >> both of my problems, 1. Why is some much of my ram used, and 2. Is an > array > >> of that size possible in VB and is there any trick in declaring/using > it? > >> Thanks, I'm stumped on this one. > > > |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|