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. QPluginLoader memory location
Forum Update on Monday, May 27th 2025

QPluginLoader memory location

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 775 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.
  • Y Offline
    Y Offline
    yuvaram
    wrote on 24 Mar 2017, 04:33 last edited by
    #1

    HI,

    QpluginLoader loads library returns instance of library.
    Return instance is created at stack memory or heap memmory, how to check memory allocation place?

    Thank you in advance.

    Yuvaram Aligeti
    Embedded Qt Developer
    : )

    J 1 Reply Last reply 24 Mar 2017, 05:23
    0
    • Y yuvaram
      24 Mar 2017, 04:33

      HI,

      QpluginLoader loads library returns instance of library.
      Return instance is created at stack memory or heap memmory, how to check memory allocation place?

      Thank you in advance.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 24 Mar 2017, 05:23 last edited by jsulm
      #2

      @yuvaram It for sure does not allocate the memory on the stack. Stack is only used for function calls: function call frames including the address to jump back after function execution, function parameters and local variables in the function.
      QPluginLoader actually does what dlopen() system call does on UNIX systems, so you can check there how it loads the library (a plug-in is just a shared library).

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Y 1 Reply Last reply 27 Mar 2017, 03:39
      3
      • V Offline
        V Offline
        Venkatesh V
        wrote on 24 Mar 2017, 07:44 last edited by
        #3

        Hi,
        The Instance , returned by this function, is not deleted when the QPluginLoader is destroyed. If you want to ensure that the instance is deleted, you should call unload() as soon you don't need to access the Instance anymore. When the library is finally unloaded, the Instance will automatically be deleted.

        1 Reply Last reply
        3
        • J jsulm
          24 Mar 2017, 05:23

          @yuvaram It for sure does not allocate the memory on the stack. Stack is only used for function calls: function call frames including the address to jump back after function execution, function parameters and local variables in the function.
          QPluginLoader actually does what dlopen() system call does on UNIX systems, so you can check there how it loads the library (a plug-in is just a shared library).

          Y Offline
          Y Offline
          yuvaram
          wrote on 27 Mar 2017, 03:39 last edited by
          #4

          @jsulm thank you.
          As i made test to check the memory allocation using threads, it confirmed that loaded plugin is not on stack , mostly on heap.

          Yuvaram Aligeti
          Embedded Qt Developer
          : )

          1 Reply Last reply
          1

          1/4

          24 Mar 2017, 04:33

          • Login

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