Even if no code executes the Xerces and Xalan libraries still have to be
mapped into your process' address space. I imagine this would take up some
amount of memory.
As far as I know, even with lazy loading, the linker will still load the
module into memory, just symbol references are resolved at a later time.
Given the way that symbol search is performed on Solaris I don't know if the
linker can avoid loading the library at program start time. There may be
some linker options you can use to actually delay loading the library. I
know such options are available on Win32 but not sure about Solaris. Perhaps
someone with more Solaris linker/loader knowledge can comment?
If not you can do this manually. Essentially you would have to write a
shared object that exposes a simple C interface, for instance:
extern "C" void doTransform(const char * styleSheetPath, const char *
xmlString, const char * outputResultPath);
Then you can dynamically load the shared object that implements this
function by using the dlopen() function and then you can load the function
pointer for doTransform from this dlopen-ed module by using the dlsym()
call. Note that you can also expose a C++ interface this way. For example:
class SimpleAbstractClass
{
public:
virtual void doTransform(const char * styleSheetPath, const char *
xmlString, const char * outputResultPath) = 0;
};
extern "C" void * CreateSimpleClass();
After executing the function CreateSimpleClass you get a pointer which you
can cast to SimpleAbstractClass and work with that.
Hope this helps.
Samar Lotia
-----Original Message-----
From: Pretorian, Mihnea [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 30, 2002 3:32 AM
To: Xalan List (E-mail)
Subject: Xalan memory consumption problem
Hello,
I am using Xalan/Xerces in a CGI application on Sun/Solaris system.
Because CGI is loaded many times in memory the application should consume as
less memory as less as possible.
I use Xalan/Xerces as shared libraries. I thought that the runtime memory
for those libraries would not be significant.
But it seams that it is.
The first question is how can I use Xalan/Xerces and to consume memory as
less as possible?
Can I compile Xalan/Xerces with some specific options for this?
Can I compile/link my application with some specific options?
I use gcc/g++ compiler and GNU linker.
One strange behavior for me was that the application used to print only its
version and nothing more uses 3.6 Mb more memory when is linked with
Xalan/Xerces, even if the module that initialize and uses Xalan/Xerces is
not touched.
Your help is greatly appreciated.
Regards,
Mihnea