Adjusting resources allocated to Jaws
Introduction
Every Mako project starts with creating an instance of the IJawsMako
object, from which all other Mako classes are derived. The parameters are described in the API documentation, and reproduced here. Examples of using this API in code are given below.
create()
|
|
|
Create an IJawsMako instance.
Only one may be created at any one time.
Parameters
| An absolute path to a directory that JawsMako can use to store temporary files. If a non-empty string is passed, the directory must exist. If an empty string is passed, JawsMako will choose an appropriate temporary location based on the host operating system. |
| An absolute path to a directory where JawsMako may persistently store cached information. If an empty string is passed, JawsMako will choose an appropriate location based on the host operating system. If a directory is passed, it must exist. |
| The desired temporary store parameters. See |
| The set of initial parameters for the JawsMako instance. Currently, this is used for licensing. |
Returns
IJawsMakoPtr
A smart pointer to the new instance.
Code examples
Mako uses sensible defaults for memory and disk allocation to the Jaws instance that it uses for PDF input, rendering, and PostScript output that works for ~99% of cases. Should an out-of-memory error occur, it may be necessary to adjust these values. The following code snippet shows how this is done:
uint64 memoryLimit = 8ULL * 1024ULL * 1024ULL * 1024ULL; // 8GB Memory
uint64 diskLimit = 100ULL * 1024ULL * 1024ULL * 1024ULL; // 100GB Disk
IJawsMakoPtr jawsMako = IJawsMako::create("", "", CTemporaryStoreParameters(memoryLimit, diskLimit));
var memoryLimit = 8UL * 1024UL * 1024UL * 1024UL; // 8GB Memory
var diskLimit = 100UL * 1024UL * 1024UL * 1024UL; // 100GB Disk
var jawsMako = IJawsMako.create("", "", new CTemporaryStoreParameters(memoryLimit, diskLimit));
var memoryLimit = BigInteger.valueOf(8 * 1024 * 1024 * (long)1024); // 8GB Memory
var diskLimit = BigInteger.valueOf(100 * 1024 * 1024 * (long)1024); // 100GB Disk
jawsMako = IJawsMako.create("", "", new CTemporaryStoreParameters(memoryLimit, diskLimit));
Detecting when temporary storage has been exhausted
A flag is set when temporary storage has been exhausted. These code examples show it being used in a catch{}
block. The flag can be reset with clearExhaustedFlag()
.