forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


4K Memory Leak Solution

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Knowledge Base
View previous topic :: View next topic  
Author Message
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Sun Mar 02, 2003 10:42 pm    Post subject: 4K Memory Leak Solution Reply with quote

I have found that the following produces a 4k Memory Leak every 1 second or so.

Code:

:evloop
wait event,1
goto @event()

:timer
if @equal(@dlgtext(check1),1)
dialog enable,edit1
else
dialog enable,edit1
end
goto evloop


Once i removed the above timer code.... My memory leak disappered. I think it may have something to do with enabling and disabling a dialog. The same happened when i tried Dialog remove Edit1, Dialog Add Edit 2

I know there has been discussions about a memory leak being caused by lists, but in my program i am using up-to 11 lists and there is no memory leak now once i removed the timer code !

Nathan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Mon Mar 03, 2003 9:26 am    Post subject: Reply with quote

The memory leak caused by LIST SAVEFILE only shows
up if the list being saved is over 20k or so (lists smaller
than 20k don't cause a memory leak when saved). And
it doesn't matter if a TIMER event is used or not...

Here's the test code if ya wanna check it out. Wink
_______________________________________________________________________________________________________________________________________________________________________________________
Code:

rem -- A test program to show SAVEFILE memory leak --
rem -- Loads Tlist with approx 40k of data and saves as mem_leak.dat
rem -- every 5 seconds. Shows available free memory at start of
rem -- operation, and monitors current free memory every second.

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"SAVEFILE Memory leak Test",-1,-1,385,160
  DIALOG ADD,TEXT,CurrentStatus,8,5,,,""
  DIALOG ADD,TEXT,StartStatus,29,5,,,"Press 'Start' button to begin..."

  DIALOG ADD,BUTTON,Start,5,300,80,20
  DIALOG ADD,BUTTON,Stop,26,300,80,20

  DIALOG ADD,LIST,Tlist,50,5,375,100,
DIALOG SHOW

rem -- Put horizontal slider on list --
%x = @sendmsg(@winexists(~Tlist),$0194,2000,0)

rem -- Creat a list of useless info --
%x = 0
REPEAT
  LIST ADD, Tlist, @datetime(yyyy/mm/dd hh:nn am/pm) This is an example program to show the memory leak in VDS SAVEFILE operations.
  %x = @succ(%x)
UNTIL @greater(%x, 400)

%x = 0

:EVLOOP
  %x = @succ(%x)
  WAIT 1, EVENT
  goto @event()

:TIMER
  DIALOG SET, CurrentStatus, @datetime(hh:nn:ss am/pm)"  Current Free Memory - "@sysinfo(FREEMEM) kb
  rem -- Check every 5 seconds --
  if @greater(%x, 5)
     if @equal(%s, "start")
        DIALOG SET, CurrentStatus, @datetime(hh:nn:ss am/pm)"  Current Free Memory - "@sysinfo(FREEMEM) kb" Saving..."
        LIST SAVEFILE, Tlist, mem_leak.dat
     end
     %x = 0
  end
  goto EVLOOP

:StartBUTTON
  %s = "start"
  DIALOG SET, StartStatus, "Free Memory At "@datetime(hh:nn:ss am/pm)" Start - "@sysinfo(FREEMEM) kb
  goto EVLOOP

:StopBUTTON
  %s = "stop"
  DIALOG SET, StartStatus, "Press 'Start' button to begin..."
  goto EVLOOP

:CLOSE
  EXIT
  STOP

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Knowledge Base All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group