Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QScriptEngine memory usage

QScriptEngine memory usage

Scheduled Pinned Locked Moved Mobile and Embedded
4 Posts 1 Posters 3.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    itoooo
    wrote on last edited by
    #1

    Hi,

    I've been playing around with QScriptEngine and I noticed it seems to use a lot of memory, on my platform (ARMv5 linux) the first QScriptEngine object instanciated allocates a 11540 KB memory block, and the next engines allocate a 2592 KB memory block each. (shown by pmap's output)

    This behavior doesn't seem odd to me, but I am wondering :

    • can those buffers be tweaked in QT's source code ?

    • what is the purpose of such huge buffers ?

    Thank you very much !

    1 Reply Last reply
    0
    • I Offline
      I Offline
      itoooo
      wrote on last edited by
      #2

      Tracking down the source of the memory usage, I could notice the first QScriptEngine creates a thread (enabled by the USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY option), this thread allocates 8MB on my system for its stack.

      This thread seems to be shared between all script engines, that's why there is a difference between the first script engine and the others.

      Still trying to optimize the memory size for each script engine (seems like the interpreter maps a 2M memory block)

      1 Reply Last reply
      0
      • I Offline
        I Offline
        itoooo
        wrote on last edited by
        #3

        I finally tracked down the other big memory block, it is instanciated by the RegisterFile class, child of the Interpreter class.

        By default it allocates 2MB for the virtual machine's stack.

        I'll try to play around with the capacity to see if it is possible to optimize it.

        1 Reply Last reply
        0
        • I Offline
          I Offline
          itoooo
          wrote on last edited by
          #4

          The last thing you can tweak if you have a small amount of memory on your system is the BLOCK_SIZE allocated by the collector, the default size is 256K if QT is not compiled for symbian nor wince, which can be much more than your scripts need.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved