Memory leak, what are the causes

For general discussion related FlowStone
Post Reply
Quentin
Posts: 37
Joined: Sat Jul 14, 2012 5:35 am

Memory leak, what are the causes

Post by Quentin »

I have a fairly large schematic, the bulk of which is just GUI type menu handling. It is a user interface I have been prototyping for industrial automation. It handles constant but very slow io via a com port, parses text commands and data rolling in, manages some timers, send commands based on logical conditions, etc.. I am running into a problem when I generate the .exe. It's memory consumption grows slowly and consistently. I run the .exe and it's consuming 44,828K in the task manager - come back 2 days later and it's up to 120,000K, will go non-responsive eventually. Has anyone debugged anything like this before? What types of conditions should I look for- I'm not generating any big arrays or saving data into memory- data gets httpposted up to a sql database in the cloud. One thing of note is that the consumption only increases when there is dataflow occuring and the accompanying parsing triggers flowing etc..
Ideas,
Quentin
User avatar
CoreStylerz
Posts: 327
Joined: Sun Jan 22, 2012 2:19 am
Location: italy
Contact:

Re: Memory leak, what are the causes

Post by CoreStylerz »

Quentin wrote:I have a fairly large schematic, the bulk of which is just GUI type menu handling. It is a user interface I have been prototyping for industrial automation. It handles constant but very slow io via a com port, parses text commands and data rolling in, manages some timers, send commands based on logical conditions, etc.. I am running into a problem when I generate the .exe. It's memory consumption grows slowly and consistently. I run the .exe and it's consuming 44,828K in the task manager - come back 2 days later and it's up to 120,000K, will go non-responsive eventually. Has anyone debugged anything like this before? What types of conditions should I look for- I'm not generating any big arrays or saving data into memory- data gets httpposted up to a sql database in the cloud. One thing of note is that the consumption only increases when there is dataflow occuring and the accompanying parsing triggers flowing etc..
Ideas,
Quentin

FS and SM before always had many problems with memory, especially arrays and great size data.
When you pass something in an array, also if you sent it out to http, that part is always in memory.
All data passed into green, string or numbers or arrays is stored.
You may can solve by cleaning always the data of client application after sending it to the cloud.

We also hope that the team will improve the data managment, since i have 8gb of rams and a FS app using 5-600 mb can be really slow.
It is also required for managing audio samples and stuff, since you can't for real load and entire 12 notes intrument in FS without crashing.
Need my support for app development, website or custom scripts?
PM me if you are interested.
Experienced Java, J2EE, PHP, Javascript, Angular, Cloud Solutions developer.
Quentin
Posts: 37
Joined: Sat Jul 14, 2012 5:35 am

Re: Memory leak, what are the causes

Post by Quentin »

Thanks for the reply. So I'm out of luck if I want to create an .exe that runs 24/7 without external watchdogs?
That's too bad. Are there really not ways that I can tighten up my schematic to minimize this effect?
Thanks,
Quentin
User avatar
CoreStylerz
Posts: 327
Joined: Sun Jan 22, 2012 2:19 am
Location: italy
Contact:

Re: Memory leak, what are the causes

Post by CoreStylerz »

Quentin wrote:Thanks for the reply. So I'm out of luck if I want to create an .exe that runs 24/7 without external watchdogs?
That's too bad. Are there really not ways that I can tighten up my schematic to minimize this effect?
Thanks,
Quentin

I suggest to avoid some parts in Green and pass them in Ruby since you can manage them better and faster, without become fool for block building!.
You can manipulate timers, triggers, arrays and all things in ruby. It should be much more fast and easy to do.

Your enemy are big arrays of data, try to make things running smaller.
Need my support for app development, website or custom scripts?
PM me if you are interested.
Experienced Java, J2EE, PHP, Javascript, Angular, Cloud Solutions developer.
tor
Posts: 114
Joined: Fri Sep 24, 2010 5:54 pm

Re: Memory leak, what are the causes

Post by tor »

If you are not afraid of sharing your osm file post it here so people can a look at it to help you debug or you could mail the file to DSProbotics support and let them have a look at it.
Quentin
Posts: 37
Joined: Sat Jul 14, 2012 5:35 am

Re: Memory leak, what are the causes

Post by Quentin »

I did send it to support and they suggested the same, more ruby blocks less wires. Debug is tricky as it does not consume memory except when connected to our hardware and parsing a dataflow. Right now I am going through the process of breaking off pieces and generating smaller test .exes to try to I'd the problem area. Unfortunately, so far it looks like many small leaks not a single issue.. Any other debug advice is appreciated.
Thanks
Quentin
User avatar
CoreStylerz
Posts: 327
Joined: Sun Jan 22, 2012 2:19 am
Location: italy
Contact:

Re: Memory leak, what are the causes

Post by CoreStylerz »

As tor suggested, if you can share with us the project will be more easy for us to help u.
Need my support for app development, website or custom scripts?
PM me if you are interested.
Experienced Java, J2EE, PHP, Javascript, Angular, Cloud Solutions developer.
Quentin
Posts: 37
Joined: Sat Jul 14, 2012 5:35 am

Re: Memory leak, what are the causes

Post by Quentin »

Hi I am re-activating my thread abt memory leak in a .exe with a com primative.
I have taken the above advice and done a series of experiments with building all my parsing in ruby, handing values through in ruby, etc. A .exe generated from the schematic that I am attaching does not grow if the COM port is not connected to a avr but as soon as I connect to a microprocessor (which is just producing a series of text strings <255 chars every 2 seconds.) the .exe memory grows and keep growing. I can't see how I can possibly strip this down any further. I welcome any advice, it seems like a bit of a watershed for making industrial control type GUI's with flowstone. e.g. programs that run for months at a time.. This .exe grows abt 3000K per hour in Win 7 tracking it with task manager. I wonder if others have made continuously running executables that handle dataflows over a COM port and are memory stable??
Thanks for all you advice so far..
Quentin
Attachments
com_rubyparse_test.fsm
(54.84 KiB) Downloaded 929 times
Tronic
Posts: 539
Joined: Wed Dec 21, 2011 12:59 pm

Re: Memory leak, what are the causes

Post by Tronic »

throughout your schematic you use often, STRING, and TEXT primitives,
those have always been an increase in memory if not reset, and it is preferable not to use them,
especially as you use it from the COM module to convert Array of Integers to an Array of String .
So you could try all the components Green to Ruby, but Ruby has some issues on performance,
when the garbage collector will use to flush the RAM data no longer used.
Quentin
Posts: 37
Joined: Sat Jul 14, 2012 5:35 am

Re: Memory leak, what are the causes

Post by Quentin »

Thanks for the reply, here is a slightly more stripped version. When connected to COM, memory still grows linearly with time running.. It is almost like the COM primative is accumulating the entire incomming datastream in a buffer and never flushing it. You refer to resetting the string and text primatives, what do you mean by reset?
Thanks,
Quentin
Attachments
com_rubyparse_test2.fsm
(29.34 KiB) Downloaded 965 times
Post Reply