login about faq

Hey there!

thanks for bringing these libs to so many languages!

I noticed by just including the "chilkat_9_5_0.php" file, my memory usage increased

running(without include and nothing else):

echo memory_get_peak_usage(); exit;

result: 407056

running(with chilkat include):

require_once 'chilkat_9_5_0.php'; echo memory_get_peak_usage(); exit;

result: 15452752

My chilkat version: DllDate: May 26 2017 ChilkatVersion: UnlockPrefix: Anything for 30-day trial Architecture: Little Endian; 64-bit Language: Linux PHP

This seems pretty heavy.. adding roughly 15MB(the numbers should be bytes) on every request or am i wrong?

Or is this the price of using swig as a wrapper?

Also here is a php blackfire profile which shows this: https://blackfire.io/profiles/042db896-1e1a-4e26-a470-1b9c18dfe173/graph

Cheers Max

asked Aug 09 at 17:28

maxmatteo's gravatar image


edited Aug 09 at 18:10

The Chilkat implementation is in C++ and is contained in the chilkat_9_5_0.so, which is about 15MB.

Assuming you are using this on the server side of a web app, I think the real question is:

If 100 requests arrive, does the server run 100 separate processes of php.exe simultaneously? In other words, does the .so share library get loaded 100 times?

(This answer is quote from https://stackoverflow.com/questions/16874355/how-apache-runs-php-for-pages)

The answer is that "it depends on the way PHP is installed. If PHP is being run via CGI, then the answer is "Yes, each request calls a separate instance of PHP". If it's being run via an Apache module, then the answer is "No, each request starts a new PHP thread within the Apache executable".

Similar variations will exist for other web servers. Please note that for a Unix/Linux based operating system, running separate copies of the executable for each request is not necessarily a bad thing for performance; the core of the OS is designed such that in many cases, tasks are better done by a number of separate executables rather than one monolithic one."

If each request is handled as a separate thread, then it should be that the .so is loaded once. (A .so is the same as a DLL on Windows. It's dynamically linked into the calling process address space. You can't really link the same .so twice.)

I think the more important question is: How long does it take to read the 1MB chilkat.php that is the argument to the "require" statement? If it's an issue, then one could probably chop out large portions of the unused functions.


answered Aug 09 at 18:28

chilkat's gravatar image

chilkat ♦♦

Thanks for your answer. This makes sense. mod_php will create an new process which is heavy.

Using ngin/fpm setup should solve that, and the extension is not loaded on every request


answered Aug 10 at 05:55

maxmatteo's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Aug 09 at 17:28

Seen: 71 times

Last updated: Aug 10 at 05:55

powered by OSQA