Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Minimize size of application in memory with Oracle DB
Forum Updated to NodeBB v4.3 + New Features

Minimize size of application in memory with Oracle DB

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 2.7k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    slopixi
    wrote on 2 Feb 2013, 13:07 last edited by
    #1

    Hi,

    I have developed in Qt 4.8 (with MSVS2008) application that is connected to OracleDB using oracle instant client and QOci sqlplugin.
    After developing basic functionality, it's time for optimizations.

    Now to the question...

    My application takes 30 MB of memory ( Release Build, also tryed Optimized Size in compiler).
    After some research I found out with VMMap, that my application is so big just because of dlls that are loaded for oracle.
    It's no big problem with one instance of application, but my application will have 36 and later 48 instances. That means it will take ~1.5GB of memory, which is not acceptable.

    How to solve this problem ?

    One possibility is to have access point to database in dedicated server app, and my application behaves as client (TcpSockets), but that will be last option. Can I force static build of application, that EXE will contain only needed functionalitys from oracle DDLs ?

    And suggestion will be appriciated.

    King regards slopixi

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on 4 Feb 2013, 18:43 last edited by
      #2

      Hi,

      one question: "Why you need to launch 36/48 instances"?
      If you really need them, I suggest to split in client/server model

      More details can be helpfull to suggest better solutions

      Regards

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • S Offline
        S Offline
        slopixi
        wrote on 5 Feb 2013, 08:11 last edited by
        #3

        Hi,

        Instances are needed because of USB connection to hardware ( One usb channel per instance).
        This is achived wich dedicated hardware.

        So my problem is that every instance of application loads dll called 'oraociei11.dll' from oracle instant client and every loaded dll takes about 30MB. Is there any possibility that this dll would be shared among my application instances ( some compiler flags maybe ?!?) ? Or how to reduce memory usage using static build ?

        King regards

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on 5 Feb 2013, 08:21 last edited by
          #4

          How did you figure that you really use that much memory? Note that the loaded code (including libraries) is shared between your running instances. So, even though each instance reports that it uses 30MB, part of that 30MB for each of those processes is actually the same physical memory.

          However, it seems weird to me to start 30-40 instances of the same application, including database features and all, on a single system. If you need a separate process to handle your USB, why don't you make just that part of the application a separate process, and control those processes from a single application with just one instance? That single application can then be responsible for the database connection, display of results, etc. You can have the processes communicate using a local socket or something like that.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mcosta
            wrote on 5 Feb 2013, 08:26 last edited by
            #5

            Hi,

            static build increase memory usage because you ave a copy of library in each instance.
            I suggest you to split your application in a server/client architecture.
            In this way you can havfe a single server application talking with ORACLE (with connection pool for example) and a client application for each USB connection.

            However, as general rule, if more applications, or more instances of the same application, load the same DLL, it will be loaded once in memory. I think the memory used from your application depends to connection instances

            Hi

            Once your problem is solved don't forget to:

            • Mark the thread as SOLVED using the Topic Tool menu
            • Vote up the answer(s) that helped you to solve the issue

            You can embed images using (http://imgur.com/) or (http://postimage.org/)

            1 Reply Last reply
            0
            • S Offline
              S Offline
              slopixi
              wrote on 5 Feb 2013, 09:16 last edited by
              #6

              Regarding share of loaded dlls in memory, based on data shown in VMMAP tool and ProcessExplorer, I don't think dlls are shared.

              !http://shrani.si/f/3u/ka/3N5hG81F/memoryusage.png(MultiInstance App)!

              I'm aware that using same instance with full functionality has disadvantages, but also has advantage that if any of instace stops working it doesn't affect other instances. Solution with one server connected to DB and other instances as clients has big disadvantage if anything goes wrong with server, all clients are useless.

              Regards

              1 Reply Last reply
              0
              • L Offline
                L Offline
                lgeyer
                wrote on 5 Feb 2013, 10:16 last edited by
                #7

                Is it possible that oraociei11.dll is indeed shared (static data and code) but each instantiation simply requires a certain amount of runtime memory (non-static data, heap and stack)?

                If so, you may take a look at Oracle Instant if it allows for tweaking its memory usage (more likely) or using shared buffers and caches among instances (less likely).

                If not, you are out of luck and you will have to create a dedicated server process to reduce memory usage (which sounds a reasonable idea in the first place, there are other ways to ensure reliability).

                1 Reply Last reply
                0

                1/7

                2 Feb 2013, 13:07

                • Login

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