It is currently Mon Apr 06, 2020 3:04 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Freeing stuff
PostPosted: Sun Sep 22, 2019 3:05 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Jun 08, 2004 10:29 am
Posts: 254
Location: Zurich, Switzerland
I have the problem that my executable constantly increases in memory usage. I use a lot of Lists and Maps, all with nested Lists and Maps, and all many levels deep. Now my questions:

1. Do I have to use ClearStructure / ClearMap / ClearList after using the variables, or is this done internally by PureBasic?

2. Do I have to use ClearStructure / FreeMap / FreeList before exiting procedures or is this done internally by PureBasic?

3. If yes, do I have to do the Clear/Free functions recursively for all nested Lists/Maps or is this done automatically?

Note: I know that I have to clear the memory when allocating memory explicitly. I am only talking about variables defined by, for example:

Code:
Protected Test.TestStruct ; Structure with Variables and nested Maps and Lists


Best regards
Wayne

_________________
As you walk on by, Will you call my name? Or will you walk away?


Top
 Profile  
Reply with quote  
 Post subject: Re: Freeing stuff
PostPosted: Sun Sep 22, 2019 5:22 pm 
Offline
Addict
Addict
User avatar

Joined: Fri May 12, 2006 6:51 pm
Posts: 2341
Location: Germany
Somehow the release works when leaving the procedure, although only "_SYS_FreeStructureStrings" is called at the end.

Have no memory increase.
Code:
;-TOP

Structure udtTest
  Text.s
  List Value.i()
EndStructure

Procedure foo()
  Protected MyData.udtTest, i
 
  MyData\Text = Space(100000)
 
  For i = 1 To 1000000
    AddElement(MyData\Value())
    MyData\Value() = i
  Next
 
EndProcedure

foo()
Delay(5000)

For i = 1 To 1000
  Debug (i)
  foo()
  Delay(20)
Next

CallDebugger


_________________
My Projects ThreadToGUI / OOP-BaseClass / OOP-BaseClassDispatch / EventDesigner V3
PB v3.30 / v5.70 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: citystate and 23 guests


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

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye