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

QPluginLoader memory location

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 771 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.
  • yuvaramY Offline
    yuvaramY Offline
    yuvaram
    wrote on 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
    : )

    jsulmJ 1 Reply Last reply
    0
    • yuvaramY yuvaram

      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.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on 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

      yuvaramY 1 Reply Last reply
      3
      • Venkatesh VV Offline
        Venkatesh VV Offline
        Venkatesh V
        wrote on 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
        • jsulmJ jsulm

          @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).

          yuvaramY Offline
          yuvaramY Offline
          yuvaram
          wrote on 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

          • Login

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