Skip navigation
Currently Being Moderated

Memory Problems when running commands

Oct 16, 2013 3:45 PM

Tags: #memory #flash #script #jsfl #cc

Hello,

 

I have a script, written in JSFL, to find all textfields in a FLA's library and then changing the text.  I do also extend flash to use a C class that I have written to cURL some data and then return it back to flash.  The current issue is that in some files it takes a very long time and a lot of memory to complete the required command.  It does not get "stuck" every time but it does seem to happen most of the time.

 

I do have a few conclusions that I have come up with:

 

  • The call to the C function seems to never cause any kind of hang up so I dont think that the C function is a problem
  • I do parse the data that comes from the C function and that doesn't seem to be a problem either
  • The problem seems to be within the function that traverses through the library and finds all the textfields
  • Another problem could be within saving some data to the document using "document.addDataToDocument", however I have reason to believe that is not an issue either which I will explain.

 

Since this script changes the text it also needs to keep track of what text was in the file originally.  I do that by saving some data, as a string, to the document.  Then when I run the command again and convert the textfields back to what they were I load the data from the document using "document.getDataFromDocument".  After that is completed I save over the saved data with an empty string ("") in order to possibly remove some of that saved off data from memory. I'm pretty sure the "get" is not slow nor is the "add". 

 

Most of the time (> 50%) the first time I convert is quick.  However, most of the time when converting back to what text I had it gets "stuck".  By "stuck" I mean memory usage starts to go up, all the way up to almost 7 GB when normally it run at or under 1GB.  The function ends up completing but taking 5+ minutes when really it should only take about 10 seconds.

 

Here is some of the memory usage I printed out last time memory went up:

 

PAGEFAULTCOUNT: 5535.2373046875

PEAKWORKINGSETSIZE: -205296

WORKINGSETSIZE: 174132

QUOTAPEAKPAGEDPOOLUSAGE: 1017.8515625

QUOTAPAGEDPOOLUSAGE: 906.0546875

QUOTAPEAKNONPAGEDPOOLUSAGE: 544.265625

QUOTANONPAGEDPOOLUSAGE: 543.71875

PAGEFILEUSAGE: -823828

PEAKPAGEFILEUSAGE: -822088

 

I dont understand the negative numbers.  Also in this case I went from < 1GB memory usage up to 6.3GB using Windows Task Manager to view memory usage.

 

 

My stats:
Windows 7 Pro Servic Pack 1 64 Bit

Intel i7-3770

8 GB Ram

NVIDIA geForce GTX 560

 

If I could debug this somehow or print out what it is currently doing that might help me figure it out but since Flash ends up "not responding" while the script is running I can't see anything happening.  I guess maybe I could write to a file over and over which I could view as it is running and now that I think about it that would help and I'll try that next. 

 

In the meantime, does anyone have any idea as to what could be causing it to get "stuck" and elevate so high in memory usage?  I have tried to optimize everything in the script as much as possible, without going to extremes. 

 

If any of this doesn't make sense or you need more info please let me know.

 

Thanks!!

 
Replies
  • Currently Being Moderated
    Oct 17, 2013 2:05 AM   in reply to etatarevic24

    Here is a good list of some known bugs with JSFL:

    http://www.xjsfl.com/support/appendix/knowledgebase/jsfl-gotchas

     

    My first guess, when i hear that you are reading/writing files would be that it is a rights/owner/permission and/or location of the files/folders you work on/from.

    Avoid network drives, and use only directories with no special charcaters, avoid spaces (in file/foldernames) too.

     

    Is there a resaon why you don`t use xml to change all the text in the texfields?

    This construct of yours seems extremly complicated for the simple task it is supposed to do.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points