QPluginLoader memory location
-
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 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). -
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. -
@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).