Skip to main content
Skip table of contents

Adjusting resources allocated to Jaws

Introduction

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:

CPP
uint64 memoryLimit = 8ULL * 1024ULL * 1024ULL * 1024ULL; // 8GB Memory
uint64 diskLimit = 100ULL * 1024ULL * 1024ULL * 1024ULL; // 100GB Disk

IJawsMakoPtr jawsMako = IJawsMako::create("", "", CTemporaryStoreParameters(memoryLimit, diskLimit));
C#
var memoryLimit = 8UL * 1024UL * 1024UL * 1024UL; // 8GB Memory
var diskLimit = 100UL * 1024UL * 1024UL * 1024UL; // 100GB Disk

var jawsMako = IJawsMako.create("", "", new CTemporaryStoreParameters(memoryLimit, diskLimit));
JAVA
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().

CPP
int wmain(int argc, wchar_t* argv[])
{
    IJawsMakoPtr jawsMako;
	try
    {
        // Create JawsMako instance
        const uint64 memoryLimit = 8ULL * 1024ULL * 1024ULL * 1024ULL; // 8GB Memory
        const uint64 diskLimit = 100ULL * 1024ULL * 1024ULL * 1024ULL; // 100GB Disk
        jawsMako = IJawsMako::create("", "", CTemporaryStoreParameters(memoryLimit, diskLimit));
        IJawsMako::enableAllFeatures(jawsMako);

        ...

        return 0;
    }
    catch (IError& e)
    {
        if (jawsMako->getTempStore()->getWasExhausted())
            std::wcerr << L"Temporary storage was exhausted." << std::endl;
        const String errorFormatString = getEDLErrorString(e.getErrorCode());
        std::wcerr << L"Exception thrown: " << e.getErrorDescription(errorFormatString) << std::endl;
        return e.getErrorCode();
    }
    catch (std::exception& e)
    {
        std::wcerr << L"std::exception thrown: " << e.what() << std::endl;
        return 1;
    }
}
C#
class Program
{
    static int Main(string[] args)
    {
        var jawsMako;
        try
        {
            // Create JawsMako instance.
            var memoryLimit = 8UL * 1024UL * 1024UL * 1024UL; // 8GB Memory
            var diskLimit = 100UL * 1024UL * 1024UL * 1024UL; // 100GB Disk
            jawsMako = IJawsMako.create("", "", new CTemporaryStoreParameters(memoryLimit, diskLimit));
            IJawsMako.enableAllFeatures(jawsMako);

            ...

        }
        catch (MakoException e)
        {
            if (jawsMako.getTempStore().getWasExhausted())
                Console.WriteLine("Temporary storage was exhausted.");
            String errorFormatString = getEDLErrorString(e.m_errorCode);
            Console.WriteLine ("Exception thrown: " +  e.m_msg);
            return 1;
        }
        catch (Exception e)
        {
            Console.WriteLine($"Exception thrown: {e}");
        }

        return 0;
    }
}


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.