Results 1 to 4 of 4

Thread: clearing memory dumps

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    didn't decide yet
    Posts
    566

    clearing memory dumps

    I have develop an app that is communicating with a modem and is parsing large strings coming from modem the problem is that as the app continue to parse strings the memory that the program is 'eating' grows enormously with result 'memory overflow' .So i though clearing those strings. Easy to do cuase the modem is sending strings only when is ringing so i though by clearing the string just b4 modem ring should clear the memory too but it doesn't . Any ideas?

    thnks

    ps: i have already used a concat class for appending parsed strings to vars
    Come and get our ISDN CallerID http://www.3wm.biz

  2. #2
    jim mcnamara
    Guest
    IF your code looks like this even in the class:

    Code:
    somebigstring = somebigstring & littlestring
    That's your memory problem. If Len(somebigstring) = 4MB it takes 8MB of memory to concatenate littlestring because concatenation requires two copies of somebigstring.

    Do something like this instead:
    Code:
    Dim arr() as string
    .........
    
    Redim Preserve arr(ubound(arr)+1)
    arr(ubound(arr) ) = littlestring
    
    ' then when you need the big string do this:
    somebigstring = Join(arr)
    Erase arr

  3. #3
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    It sounds to me like the problem is possibly that you are creating many instances of your class and not destroying them afterwards.

    As far as I am aware str = "" should free the memory that the string was using (unless you have intentionally declared the strings as fixed length).
    This world is not my home. I'm just passing through.

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    didn't decide yet
    Posts
    566
    because the project has become too large and too complicated its difficult to use the concat class in all the vars so I wanted to know if there is a another way to clear all trashes from memory
    Come and get our ISDN CallerID http://www.3wm.biz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width