Project

Profile

Help

Bug #6025 ยป Re_ [SaxonC - Bug #6025] Python Saxon not releasing memory - 2023-05-16T11_11_51Z.eml

Mark Pierce, 2023-05-16 13:11

 
X-He-Spam-Score: 3.9
Return-Path: <Mark.Pierce@cdl.co.uk>
Delivered-To: dropbox@plan.io
Received: from m.launch.gmbh ([127.0.0.1])
by m.launch.gmbh with LMTP id UB52JetkY2ThXwAAJzdhvw
for <dropbox@plan.io>; Tue, 16 May 2023 13:11:39 +0200
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on m.launch.gmbh
X-Spam-Level: ***
X-Spam-Status: No, score=3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,FORGED_SPF_HELO,HTML_MESSAGE,
RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_FAIL,SPF_HELO_PASS,
T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2
X-Spam-Report:
* -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at
* https://www.dnswl.org/, no trust
* [40.107.11.56 listed in list.dnswl.org]
* -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
* [score: 0.0000]
* 5.0 SPF_FAIL SPF check failed
* -0.1 DMARC_PASS DMARC check passed
* -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2)
* [40.107.11.56 listed in wl.mailspike.net]
* -0.0 SPF_HELO_PASS SPF: HELO matches SPF record
* 0.0 HTML_MESSAGE BODY: HTML included in message
* -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
* -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
* author's domain
* 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily
* valid
* 1.0 FORGED_SPF_HELO No description available.
* -0.0 T_SCC_BODY_TEXT_LINE No description available.
X-Spam-Score: 3.9
Envelope-to: inbox+saxonica+f38e+saxon-c@plan.io
Authentication-Results: m.launch.gmbh; dmarc=pass (p=none dis=none) header.from=cdl.co.uk
Authentication-Results: m.launch.gmbh; spf=fail smtp.mailfrom=Mark.Pierce@cdl.co.uk
Authentication-Results: m.launch.gmbh;
dkim=pass (2048-bit key; unprotected) header.d=cdl.co.uk header.i=@cdl.co.uk header.b="IA8TYEY/";
dkim-atps=neutral
Received: from GBR01-CWL-obe.outbound.protection.outlook.com (mail-cwlgbr01on2056.outbound.protection.outlook.com [40.107.11.56])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by m.launch.gmbh (Postfix) with ESMTPS id 5DACE805F6
for <inbox+saxonica+f38e+saxon-c@plan.io>; Tue, 16 May 2023 13:11:38 +0200 (CEST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=kdAzBAwXsldLNiVfkdLXn6gnm5jixxphWiMTZDBsiw4stuXVAQdFfn5utxE5kWVVZwI27m7wlaapGVWTbd4DFYS5VPrcc5lcGQn202Dhwtkg9Gyvy8gk8Hl9cAddg3PXDd427Pdrzqb28wLK38PcW3f1va46/ArpQENUiZ3Jk73UwhEPJLm0HM+wfu4koUR76Omadr4fHuGjLZggUWkzykAzuAOhUBjU/jAkJQfSdE40fhVP6f5QeI63fkNfepC+CO3Xj/Wu3uZtOGH59KPR7EOiZMVubG+QHXB9MZjkENB9AxqFYg+M6QRqagZ2AnpoyyTTBe84GCIS8iwH7ENobQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector9901;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=WVg447nvlrq1JjZU/NnvUsleVW8AKoZaAYHqDp+Xs9k=;
b=OwsTNkYWAe50LX603pZedNkBgduakZBDhre8QeKZfQztVVjOQSJURq4ZwU6XolnjpvXgVS01HQ3FWBzQcZFpy2HF1KiVRwt8TPqAG+hO1AqCJg0bUFiXvq9QJOT+ED30VniS/CGAzALqdP5Q2KSK73nZtm1/yU8Yb6SiB0++rPWgglHCx3555JWDoDZqhpKgpoyMCcf5DiLwoKG6W4cVtN4OnOxFynhLdwL5xTYu8tZ6k6hazKaMvcGRMdBJgDnWIHhD02RCPabO5g+fZ9QZ8LWADZebQL50QsJKkUdQ3XTQ0vkLE5ZjfvJf7czRANGUtQOqVMUJpkOWit9PCqe/qw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=cdl.co.uk; dmarc=pass action=none header.from=cdl.co.uk;
dkim=pass header.d=cdl.co.uk; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cdl.co.uk;
s=selector2;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=WVg447nvlrq1JjZU/NnvUsleVW8AKoZaAYHqDp+Xs9k=;
b=IA8TYEY/H0gswKO0//TN98TAr2A1AYqXgTH3mVRiMqXqMDirGdC3rTESymtew65wK8KAFpTCm2rlpJph6k6jxabQm+0v2hj1migCqkObF1zwmC3u9h8biqgjJLNhr5vQ8pNrGkkC01xEpODi3fw6QL9+AE2aAgYzzzxlcO00DajiZx7RFSwKJCO13o5t4ouxbbG8AUNfL52e4+EJio2Q9v7T21EocTGyCdSHJDQyg234TDgn8n2cTCucOrMetwgQ7UIU4YUXGLxc58pWtevqpJASSQQuIFKpfpB5R7w9bMzuRtaqTd6wEKRQliRrn6o4tJBLeWXvSCUnsKNQicQcgg==
Received: from CWLP123MB5136.GBRP123.PROD.OUTLOOK.COM (2603:10a6:400:12f::8)
by LO2P123MB5671.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:22e::11) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.33; Tue, 16 May
2023 11:11:35 +0000
Received: from CWLP123MB5136.GBRP123.PROD.OUTLOOK.COM
([fe80::90af:a574:9b61:1ac9]) by CWLP123MB5136.GBRP123.PROD.OUTLOOK.COM
([fe80::90af:a574:9b61:1ac9%7]) with mapi id 15.20.6387.033; Tue, 16 May 2023
11:11:35 +0000
From: Mark Pierce <Mark.Pierce@cdl.co.uk>
To: Saxonica Developer Community <inbox+saxonica+f38e+saxon-c@plan.io>
Subject: Re: [SaxonC - Bug #6025] Python Saxon not releasing memory
Thread-Topic: [SaxonC - Bug #6025] Python Saxon not releasing memory
Thread-Index: AQHZh+MmzNp6DSaPb0STRZ50zUWLT69cvg7Q
Date: Tue, 16 May 2023 11:11:35 +0000
Message-ID:
<CWLP123MB513609D3C1FC3C1965C46F9EB0799@CWLP123MB5136.GBRP123.PROD.OUTLOOK.COM>
References: <redmine.issue-6025.20230509150033.4040@plan.io>
<redmine.journal-23824.20230516104241.4040@plan.io>
In-Reply-To: <redmine.journal-23824.20230516104241.4040@plan.io>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
msip_labels:
MSIP_Label_d38e73b6-277a-44a2-a6e4-3be273e67173_Enabled=True;MSIP_Label_d38e73b6-277a-44a2-a6e4-3be273e67173_SiteId=b9421abd-55d8-45be-b89b-aa8974ddbc7f;MSIP_Label_d38e73b6-277a-44a2-a6e4-3be273e67173_SetDate=2023-05-16T11:11:34.7090425Z;MSIP_Label_d38e73b6-277a-44a2-a6e4-3be273e67173_ContentBits=0;MSIP_Label_d38e73b6-277a-44a2-a6e4-3be273e67173_Method=Privileged
authentication-results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=cdl.co.uk;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: CWLP123MB5136:EE_|LO2P123MB5671:EE_
x-ms-office365-filtering-correlation-id: fe1fee8c-ca49-4d1b-8c51-08db55fe500f
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info:
mymOJuZkXhlDSXYWYQcobOFFn4+g/CWZim5VfOXzbOtlO8EK58kGcGfQRm3//GfrcAeqizYSG7KqyTj8PQF8yjesxzruynye8/571w4EbpQYISmKYFO4p5nUTORaaMuRRjxpGhnaj+bE1dJQ7Fsqwdky9VU8NYr27D5GBZeBho+jVFPODuTmFmyuvsovtuR+i6jOAOC0M0iPXY82GCeWQBJlH4zIIbhkmilYKiT64WgzZTIwrHBJhy8hdldM4GLIr5tBGU7X1dQIEn8ut2rx8WjixJ/7cLpECiyOu9uj7Mgpl7JYBafR/zlA+32iUbTNRq9caH3DU6ljpBpiMxUFTNlC1L/hlIFuzQtKdITqqmOYOI47qrOJ7KaLOtTg7T8dXQAo9X26q7IEEWn9DGPy1eLHGm8Q7kD5Awn4iSKS+WwmBnQz7mNvVlHr9pUh4HIY4VODqTAz3XGsAnTwabiBWVr4qDuQRYgHYgmy/6Gc49iHHP1ekYndgGkrT94LTGHNNJeUZLgX/F10kUT+p2aaL6qpHx/VqT7TPD7VYJ5xblU0m3ozJrDG3UuEUd35h/Rns9kMNXPbarCnItAY8CwLHiRfcL4Rw80PMs3yi8WipP0=
x-forefront-antispam-report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWLP123MB5136.GBRP123.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39850400004)(366004)(346002)(396003)(376002)(136003)(1690799014)(451199021)(2906002)(52536014)(21615005)(41300700001)(7696005)(478600001)(91956017)(5660300002)(66946007)(66446008)(64756008)(66556008)(66476007)(8676002)(8936002)(76116006)(316002)(71200400001)(966005)(53546011)(9686003)(26005)(6506007)(55236004)(186003)(55016003)(66574015)(38070700005)(40140700001)(166002)(86362001)(83380400001)(33656002)(122000001)(38100700002);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0:
=?us-ascii?Q?r3Ec2R4Rh11r6Ub5LhOLpy2jplZqJvNvrQdcdRS4TS6gNCGGz7y8ZgfPjIeu?=
=?us-ascii?Q?FDBvRTIJfYkdkKSuc95H0Gz6+O2R4mmgTSiWKmeYPJnujAKMxe3yST/pZHhr?=
=?us-ascii?Q?suXZMf7aq4t4pfX3CIIAQyQ80Q/hddxUpcs1e3kOeXP1PmMd1HNuszDMRWGi?=
=?us-ascii?Q?Mk10jns4C3UouYV4cyEd+kx6BUB27XxF85f86qfRBuw67nfjM7ZwFCzRyjHO?=
=?us-ascii?Q?F9KwGcI4K3KVWUdXfb2+JDRh+6Ers5hjCzp68ydFBE5+XcBrXcZwWvxSUX5W?=
=?us-ascii?Q?DKZteIoYyXCQQvyl5ZojRz9OaZtUGaqt9P4Y3/+fEmCgT1U896dnOgthjjy3?=
=?us-ascii?Q?h9a5uy+Ybu3YIumW71jy4roE/ocqcAXMLCKt13cF/MZIfs7ZsuGoOu3OE/9i?=
=?us-ascii?Q?YVlQVfQ/i5u4Y3s7SjufCnfKAVp3m6SYmC61IQH2gdh+4LERapwcppjoo2BM?=
=?us-ascii?Q?Jn9nV75qYobwlUZSCQeUM0zV2krE/bmW0FFQC3nS9bkmNZ8cptUO9vz2ogYM?=
=?us-ascii?Q?1vmJYZU+/UBuD9CHme0NWcgswaTD+vML/ckZgngpsl4VxNxIPpaoPfx9yiPI?=
=?us-ascii?Q?IAsRDcqFVEYIERdaw75IEcgRjFsTLUkJ0DH9VayeN6fqpXonuwXMYeQxKaDl?=
=?us-ascii?Q?xJAo4leZrU6zEx35Mt5za9y4R/Z7lg4DITNmNFLw9856brzyITizKqg0UAH4?=
=?us-ascii?Q?/vloPFlcCw12M1+IRWNaBTufeE3T22RdHUg8FsEdabHafYM7A2Gdt/58C26E?=
=?us-ascii?Q?63J7BwoWDc3rN5dzhLoj1U1dizsIFqrtlMvOf0uq1Hlyl3dhoRqmAS6+6/Dj?=
=?us-ascii?Q?LgoB/FgNb1vakKs0bSfuZ3eSOtx+WZdOPPYrjbXOULmN/RjROov8CqX+0PZV?=
=?us-ascii?Q?5hBw2gSJ8zTpgmosXIDEodqSIXwIbro2E+kte6xafNR9jOA7w2H7ntgj+gaG?=
=?us-ascii?Q?UaBu08zHOL+ZId5DXZu++1MU13Y9/todrRPtXI0wPN72Lokb4574J3xEm1aH?=
=?us-ascii?Q?F5DUog5Kz0wqNamAo41+pOn4oAe030LCCsc2OAhGy47P0PCJh6l2OE+nN56d?=
=?us-ascii?Q?tj+wP18brAt3En3enTC7CR2QvCk3UkPv/Bo0o+SM5vAsC/FmoYvvoz2OPkVK?=
=?us-ascii?Q?GTR+B5ktdEyTPXbFeml8mSHMGWwtvlwlFMaSBedl7DpQ9IL+UD4BsYYBrhMY?=
=?us-ascii?Q?dy86JDPmNs25RRAlJa99+9Qn1DoFmnItwIkRZtmlYNIXtCmewIIEWoKX/zTU?=
=?us-ascii?Q?HxPftN6vBltuWCq7ZNYp52tY0dEJfnQ6wEib5uQ7lpt9lT91a6JE9mJf59EE?=
=?us-ascii?Q?TVDLMfkDqJXxNXfO6RdHuQNEoo+qB2VquqG3r82WovJuSBMuAxr8/EshdYOq?=
=?us-ascii?Q?6YbKbhe26m6I0Kb9NWU37TixwGnOIY3jJCcCKYvwQqjODLAn+VItcCTnH9XP?=
=?us-ascii?Q?iH5ccAcfDLsy3Xfuek6vcLtjVlxpx9R3DLhVHL4Pvdy2+L52IuzFWe06YeCs?=
=?us-ascii?Q?vE/f7elTgEFKIMOM+Q6u7cbLCmT4Wk3CHxiw7zNlYIJqeSt9PVVzeKibV91u?=
=?us-ascii?Q?jJYtk7IAV/3K4QyYXj5KR5FxdkpUWlHSv3MsizWTk+uQIvSN055VZnMbsntx?=
=?us-ascii?Q?kg=3D=3D?=
Content-Type: multipart/alternative;
boundary="_000_CWLP123MB513609D3C1FC3C1965C46F9EB0799CWLP123MB5136GBRP_"
MIME-Version: 1.0
X-OriginatorOrg: cdl.co.uk
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: CWLP123MB5136.GBRP123.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-Network-Message-Id: fe1fee8c-ca49-4d1b-8c51-08db55fe500f
X-MS-Exchange-CrossTenant-originalarrivaltime: 16 May 2023 11:11:35.6205
(UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: b9421abd-55d8-45be-b89b-aa8974ddbc7f
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: qnT89rnfHUMlDq0D6+rKVZmybuzfL0tfOczrrGxAXvBmC2S1Yw4Wb2etx4RJMN8v7O7dWREyLLwlhSHAvY23VQ==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO2P123MB5671

--_000_CWLP123MB513609D3C1FC3C1965C46F9EB0799CWLP123MB5136GBRP_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi.

Currently we are running the AWS lambda with 1024MB RAM.

However, the example I included I am running locally where I have 16GB RAM =
and am running Mac OS 13.3.1(a) on an M1 Pro.

As this occurs running locally I do not believe this is a lambda issue.

Thanks,

Mark.

From: Saxonica Developer Community <notifications@plan.io>
Date: Tuesday, 16 May 2023 at 11:42
To: Mark Pierce <Mark.Pierce@cdl.co.uk>
Subject: [SaxonC - Bug #6025] Python Saxon not releasing memory

--- In your reply, please do not write below this line ---
Issue #6025<https://saxonica.plan.io/issues/6025?pn=3D1#change-23824> has b=
een updated by O'Neil Delpratt.
________________________________

Hi Mark,

We have been investigating this issue. Specifically looking at the heap dum=
p produced by Graalvm. As default, Graalvm sets a max heap size available o=
f 25% on the total machine memory. It is possible that the garbage collecti=
on is not being triggered in the lambda server. I have looked at configurin=
g the maxHeapSize in a standalone machine which did some improvements in me=
mory usage.

I would like to under more about your environment. What are your configurat=
ions on memory? such as max memory available?

________________________________
Bug #6025: Python Saxon not releasing memory<https://saxonica.plan.io/issue=
s/6025?pn=3D1#change-23824> open

* Author: Mark Pierce
* Status: In Progress
* Priority: Normal
* Assignee: O'Neil Delpratt
* Category: Python
* Start date: 2023-05-09

I've recently built an AWS Lambda running Python 3.10 that takes a request,=
transforms it and returns the result.

This all seems fine and works quite well.

The issue is with each invocation the memory usage and runtime grows until =
it hits the limit and the lambda instance is killed off.

I've knocked up a very simple program that I can run locally which demonstr=
ates this behaviour.

import psutil

from saxoncpe import *



process =3D psutil.Process()

start_memory =3D process.memory_info().rss



with PySaxonProcessor(license=3DTrue) as saxon_processor:

xslt_proc =3D saxon_processor.new_xslt30_processor()

document =3D saxon_processor.parse_xml(xml_text=3D"<request></request>"=
)

executable =3D xslt_proc.compile_stylesheet(stylesheet_file=3D"transfor=
ms/QuoteRequest-sample.xslt")



values =3D range(1000)

for i in values:

executable.transform_to_string(xdm_node=3Ddocument)

print(process.memory_info().rss)



end_process =3D psutil.Process()

print("Start memory:")

print(start_memory)

print("End memory:")

print(process.memory_info().rss)

If you comment out all of the Saxon code then you will see the memory does =
not increase. If you move most of it out of the for loop, so it's only call=
ed once, and only have the transform_to_string function in the loop then th=
e memory still increases.

What is cause the memory to be locked? How can I release it so it can be us=
ed in an AWS lambda with 100s and 1000s of requests?

________________________________

You have received this notification because you have either subscribed to o=
r are involved in a project on Saxonica Developer Community site. To change=
your notification preferences, please click here: https://saxonica.plan.io=
/my/account?tour=3Dmail_preferences

This notification was cheerfully delivered by<https://plan.io/>
[Planio]<https://plan.io/>

[https://www.cdl.co.uk/assets/site-wide/social-newshub-icon.jpeg]<https://w=
ww.cdl.co.uk/media/newsletter.html>[https://www.cdl.co.uk/assets/site-wide/=
social-vacancy-icon.png]<https://www.cdl.co.uk/careers/vacancies.html>[http=
s://www.cdl.co.uk/assets/site-wide/social-twitter-icon.png]<http://twitter.=
com/CDL_Software>[https://www.cdl.co.uk/assets/site-wide/social-linkedin-ic=
on.png]<http://www.linkedin.com/company/cdl-cheshire-datasystems-ltd->[http=
s://www.cdl.co.uk/assets/site-wide/social-facebook-icon.png]<https://en-gb.=
facebook.com/CDLSoftware>
________________________________

Please consider the environment - Do you really need to print this email?

This email is intended only for the person(s) named above and may contain p=
rivate and confidential information. If it has come to you in error, please=
destroy and permanently delete any copy in your possession, and contact us=
on +44 (0)161 480 4420. The information in this email is copyright (c) CDL=
Group Holdings Limited. We cannot accept liability for any loss or damage =
sustained as a result of software viruses. It is your responsibility to car=
ry out such virus checking as is necessary before opening any attachment.

Cheshire Datasystems Limited uses software which automatically screens inco=
ming emails for inappropriate content and attachments. If the software iden=
tifies such content or attachment, the email will be forwarded to our Techn=
ology department for checking. You should be aware that any email that you =
send to Cheshire Datasystems Limited is subject to this procedure.

________________________________
Cheshire Datasystems Limited, Strata House, Kings Reach Road, Stockport, SK=
4 2HD
Registered in England and Wales with company number 3991057
VAT registration: 727 1188 33


CDL - EXTERNAL

--_000_CWLP123MB513609D3C1FC3C1965C46F9EB0799CWLP123MB5136GBRP_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
h1
{mso-style-priority:9;
mso-style-link:"Heading 1 Char";
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:24.0pt;
font-family:"Calibri",sans-serif;
font-weight:bold;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0088B7;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
font-size:10.0pt;
font-family:"Courier New";}
span.Heading1Char
{mso-style-name:"Heading 1 Char";
mso-style-priority:9;
mso-style-link:"Heading 1";
font-family:"Calibri Light";
color:#2F5496;}
span.badge
{mso-style-name:badge;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.kn
{mso-style-name:kn;}
span.nn
{mso-style-name:nn;}
span.o
{mso-style-name:o;}
span.n
{mso-style-name:n;}
span.p
{mso-style-name:p;}
span.k
{mso-style-name:k;}
span.bp
{mso-style-name:bp;}
span.s
{mso-style-name:s;}
span.nb
{mso-style-name:nb;}
span.mi
{mso-style-name:mi;}
span.ow
{mso-style-name:ow;}
span.EmailStyle36
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:237328249;
mso-list-template-ids:178710604;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1
{mso-list-id:326373260;
mso-list-template-ids:1352852344;}
@list l1:level1
{mso-level-number-format:bullet;
mso-level-text:\F0B7 ;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l1:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l1:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level4
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level5
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level7
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level8
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l1:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7 ;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-GB" link=3D"#0088B7" vlink=3D"#0088B7" style=3D"word-wrap:=
break-word">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US">Hi.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US">Currently we are running the AWS lambda with 1024MB RAM.<o:p></o:p>=
</span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US">However, the example I included I am running locally where I have 1=
6GB RAM and am running Mac OS 13.3.1(a) on an M1 Pro.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US">As this occurs running locally I do not believe this is a lambda is=
sue.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US">Thanks,<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US"><o:p>&nbsp;</o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US">Mark.<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;mso-fareast-language=
:EN-US"><o:p>&nbsp;</o:p></span></p>
<div style=3D"border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm =
0cm 0cm">
<p class=3D"MsoNormal" style=3D"margin-bottom:12.0pt;line-height:16.8pt"><b=
><span style=3D"font-size:12.0pt;color:black">From:
</span></b><span style=3D"font-size:12.0pt;color:black">Saxonica Developer =
Community &lt;notifications@plan.io&gt;<br>
<b>Date: </b>Tuesday, 16 May 2023 at 11:42<br>
<b>To: </b>Mark Pierce &lt;Mark.Pierce@cdl.co.uk&gt;<br>
<b>Subject: </b>[SaxonC - Bug #6025] Python Saxon not releasing memory<o:p>=
</o:p></span></p>
</div>
<table class=3D"MsoNormalTable" border=3D"0" cellspacing=3D"0" cellpadding=
=3D"0" width=3D"100%" style=3D"width:100.0%;border-collapse:collapse;border=
-spacing:0">
<tbody>
<tr>
<td width=3D"100%" style=3D"width:100.0%;padding:0cm 0cm 0cm 0cm">
<p align=3D"center" style=3D"text-align:center"><span style=3D"font-size:9.=
0pt;font-family:Helvetica;color:#D7D7D7">--- In your reply, please do not w=
rite below this line ---<o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style=3D"padding:0cm 0cm 0cm 0cm">
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Issue <a href=3D"ht=
tps://saxonica.plan.io/issues/6025?pn=3D1#change-23824">
#6025</a> has been updated by O'Neil Delpratt. <o:p></o:p></span></p>
<div class=3D"MsoNormal" align=3D"center" style=3D"mso-margin-top-alt:14.4p=
t;margin-right:0cm;margin-bottom:14.4pt;margin-left:0cm;text-align:center">
<span style=3D"font-size:11.0pt">
<hr size=3D"1" width=3D"100%" align=3D"center">
</span></div>
<p>Hi Mark,<o:p></o:p></p>
<p>We have been investigating this issue. Specifically looking at the heap =
dump produced by Graalvm. As default, Graalvm sets a max heap size availabl=
e of 25% on the total machine memory. It is possible that the garbage colle=
ction is not being triggered in
the lambda server. I have looked at configuring the maxHeapSize in a stand=
alone machine which did some improvements in memory usage.<o:p></o:p></p>
<p>I would like to under more about your environment. What are your configu=
rations on memory? such as max memory available?<o:p></o:p></p>
<div class=3D"MsoNormal" align=3D"center" style=3D"mso-margin-top-alt:14.4p=
t;margin-right:0cm;margin-bottom:14.4pt;margin-left:0cm;text-align:center">
<span style=3D"font-size:11.0pt">
<hr size=3D"1" width=3D"100%" align=3D"center">
</span></div>
<h1 style=3D"margin:0cm;line-height:16.8pt"><span style=3D"font-size:14.5pt=
;font-family:Helvetica;font-weight:normal"><a href=3D"https://saxonica.plan=
.io/issues/6025?pn=3D1#change-23824"><span style=3D"text-decoration:none">B=
ug #6025: Python Saxon not releasing memory</span></a>
</span><span class=3D"badge"><span style=3D"font-size:7.5pt;font-family:Hel=
vetica;color:#205D86;text-transform:uppercase;border:solid #205D86 1.0pt;pa=
dding:1.0pt">open</span></span><span style=3D"font-size:14.5pt;font-family:=
Helvetica;font-weight:normal">
<o:p></o:p></span></h1>
<ul type=3D"disc">
<li class=3D"MsoNormal" style=3D"color:#959595;mso-margin-top-alt:auto;mso-=
margin-bottom-alt:auto;mso-list:l1 level1 lfo2">
<strong><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,san=
s-serif">Author: </span>
</strong><span style=3D"font-size:11.0pt">Mark Pierce<o:p></o:p></span></li=
><li class=3D"MsoNormal" style=3D"color:#959595;mso-margin-top-alt:auto;mso=
-margin-bottom-alt:auto;mso-list:l1 level1 lfo2">
<strong><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,san=
s-serif">Status: </span>
</strong><span style=3D"font-size:11.0pt">In Progress<o:p></o:p></span></li=
><li class=3D"MsoNormal" style=3D"color:#959595;mso-margin-top-alt:auto;mso=
-margin-bottom-alt:auto;mso-list:l1 level1 lfo2">
<strong><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,san=
s-serif">Priority:
</span></strong><span style=3D"font-size:11.0pt">Normal<o:p></o:p></span></=
li><li class=3D"MsoNormal" style=3D"color:#959595;mso-margin-top-alt:auto;m=
so-margin-bottom-alt:auto;mso-list:l1 level1 lfo2">
<strong><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,san=
s-serif">Assignee:
</span></strong><span style=3D"font-size:11.0pt">O'Neil Delpratt<o:p></o:p>=
</span></li><li class=3D"MsoNormal" style=3D"color:#959595;mso-margin-top-a=
lt:auto;mso-margin-bottom-alt:auto;mso-list:l1 level1 lfo2">
<strong><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,san=
s-serif">Category:
</span></strong><span style=3D"font-size:11.0pt">Python<o:p></o:p></span></=
li><li class=3D"MsoNormal" style=3D"color:#959595;mso-margin-top-alt:auto;m=
so-margin-bottom-alt:auto;mso-list:l1 level1 lfo2">
<strong><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,san=
s-serif">Start date:
</span></strong><span style=3D"font-size:11.0pt">2023-05-09<o:p></o:p></spa=
n></li></ul>
<p>I've recently built an AWS Lambda running Python 3.10 that takes a reque=
st, transforms it and returns the result.<o:p></o:p></p>
<p>This all seems fine and works quite well.<o:p></o:p></p>
<p>The issue is with each invocation the memory usage and runtime grows unt=
il it hits the limit and the lambda instance is killed off.<o:p></o:p></p>
<p>I've knocked up a very simple program that I can run locally which demon=
strates this behaviour.<o:p></o:p></p>
<pre style=3D"background:#ECECEC;border-radius:3px;overflow-x:auto;overflow=
-y:hidden"><span class=3D"kn"><span style=3D"font-size:8.0pt;font-family:Co=
nsolas;color:black;background:#ECECEC">import</span></span><code><span styl=
e=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> =
</span></code><span class=3D"nn"><span style=3D"font-size:8.0pt;font-family=
:Consolas;color:black;background:#ECECEC">psutil</span></span><code><span s=
tyle=3D"font-size:8.0pt;font-family:Consolas;background:#ECECEC"><o:p></o:p=
></span></code></pre>
<pre style=3D"background:#ECECEC"><span class=3D"kn"><span style=3D"font-si=
ze:8.0pt;font-family:Consolas;color:black;background:#ECECEC">from</span></=
span><code><span style=3D"font-size:8.0pt;font-family:Consolas;color:black;=
background:#ECECEC"> </span></code><span class=3D"nn"><span style=3D"font-s=
ize:8.0pt;font-family:Consolas;color:black;background:#ECECEC">saxoncpe</sp=
an></span><code><span style=3D"font-size:8.0pt;font-family:Consolas;color:b=
lack;background:#ECECEC"> </span></code><span class=3D"kn"><span style=3D"f=
ont-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">import<=
/span></span><code><span style=3D"font-size:8.0pt;font-family:Consolas;colo=
r:black;background:#ECECEC"> </span></code><span class=3D"o"><span style=3D=
"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">*</sp=
an></span><code><span style=3D"font-size:8.0pt;font-family:Consolas;backgro=
und:#ECECEC"><o:p></o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><code><span style=3D"font-size:8.0pt;font=
-family:Consolas;background:#ECECEC"><o:p>&nbsp;</o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><span class=3D"n"><span style=3D"font-siz=
e:8.0pt;font-family:Consolas;color:black;background:#ECECEC">process</span>=
</span><code><span style=3D"font-size:8.0pt;font-family:Consolas;color:blac=
k;background:#ECECEC"> </span></code><span class=3D"o"><span style=3D"font-=
size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">=3D</span><=
/span><code><span style=3D"font-size:8.0pt;font-family:Consolas;color:black=
;background:#ECECEC"> </span></code><span class=3D"n"><span style=3D"font-s=
ize:8.0pt;font-family:Consolas;color:black;background:#ECECEC">psutil</span=
></span><span class=3D"p"><span style=3D"font-size:8.0pt;font-family:Consol=
as;color:black;background:#ECECEC">.</span></span><span class=3D"n"><span s=
tyle=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC=
">Process</span></span><span class=3D"p"><span style=3D"font-size:8.0pt;fon=
t-family:Consolas;color:black;background:#ECECEC">()</span></span><code><sp=
an style=3D"font-size:8.0pt;font-family:Consolas;background:#ECECEC"><o:p><=
/o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><span class=3D"n"><span style=3D"font-siz=
e:8.0pt;font-family:Consolas;color:black;background:#ECECEC">start_memory</=
span></span><code><span style=3D"font-size:8.0pt;font-family:Consolas;color=
:black;background:#ECECEC"> </span></code><span class=3D"o"><span style=3D"=
font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">=3D</s=
pan></span><code><span style=3D"font-size:8.0pt;font-family:Consolas;color:=
black;background:#ECECEC"> </span></code><span class=3D"n"><span style=3D"f=
ont-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">process=
</span></span><span class=3D"p"><span style=3D"font-size:8.0pt;font-family:=
Consolas;color:black;background:#ECECEC">.</span></span><span class=3D"n"><=
span style=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#=
ECECEC">memory_info</span></span><span class=3D"p"><span style=3D"font-size=
:8.0pt;font-family:Consolas;color:black;background:#ECECEC">().</span></spa=
n><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:Consolas;col=
or:black;background:#ECECEC">rss</span></span><code><span style=3D"font-siz=
e:8.0pt;font-family:Consolas;background:#ECECEC"><o:p></o:p></span></code><=
/pre>
<pre style=3D"background:#ECECEC"><code><span style=3D"font-size:8.0pt;font=
-family:Consolas;background:#ECECEC"><o:p>&nbsp;</o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><span class=3D"k"><span style=3D"font-siz=
e:8.0pt;font-family:Consolas;color:black;background:#ECECEC">with</span></s=
pan><code><span style=3D"font-size:8.0pt;font-family:Consolas;color:black;b=
ackground:#ECECEC"> </span></code><span class=3D"n"><span style=3D"font-siz=
e:8.0pt;font-family:Consolas;color:black;background:#ECECEC">PySaxonProcess=
or</span></span><span class=3D"p"><span style=3D"font-size:8.0pt;font-famil=
y:Consolas;color:black;background:#ECECEC">(</span></span><span class=3D"n"=
><span style=3D"font-size:8.0pt;font-family:Consolas;color:black;background=
:#ECECEC">license</span></span><span class=3D"o"><span style=3D"font-size:8=
.0pt;font-family:Consolas;color:black;background:#ECECEC">=3D</span></span>=
<span class=3D"bp"><span style=3D"font-size:8.0pt;font-family:Consolas;colo=
r:black;background:#ECECEC">True</span></span><span class=3D"p"><span style=
=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">)<=
/span></span><code><span style=3D"font-size:8.0pt;font-family:Consolas;colo=
r:black;background:#ECECEC"> </span></code><span class=3D"k"><span style=3D=
"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">as</s=
pan></span><code><span style=3D"font-size:8.0pt;font-family:Consolas;color:=
black;background:#ECECEC"> </span></code><span class=3D"n"><span style=3D"f=
ont-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">saxon_p=
rocessor</span></span><span class=3D"p"><span style=3D"font-size:8.0pt;font=
-family:Consolas;color:black;background:#ECECEC">:</span></span><code><span=
style=3D"font-size:8.0pt;font-family:Consolas;background:#ECECEC"><o:p></o=
:p></span></code></pre>
<pre style=3D"background:#ECECEC"><code><span style=3D"font-size:8.0pt;font=
-family:Consolas;color:black;background:#ECECEC">&nbsp;&nbsp;&nbsp; </span>=
</code><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:Consola=
s;color:black;background:#ECECEC">xslt_proc</span></span><code><span style=
=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> <=
/span></code><span class=3D"o"><span style=3D"font-size:8.0pt;font-family:C=
onsolas;color:black;background:#ECECEC">=3D</span></span><code><span style=
=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> <=
/span></code><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:C=
onsolas;color:black;background:#ECECEC">saxon_processor</span></span><span =
class=3D"p"><span style=3D"font-size:8.0pt;font-family:Consolas;color:black=
;background:#ECECEC">.</span></span><span class=3D"n"><span style=3D"font-s=
ize:8.0pt;font-family:Consolas;color:black;background:#ECECEC">new_xslt30_p=
rocessor</span></span><span class=3D"p"><span style=3D"font-size:8.0pt;font=
-family:Consolas;color:black;background:#ECECEC">()</span></span><code><spa=
n style=3D"font-size:8.0pt;font-family:Consolas;background:#ECECEC"><o:p></=
o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><code><span style=3D"font-size:8.0pt;font=
-family:Consolas;color:black;background:#ECECEC">&nbsp;&nbsp;&nbsp; </span>=
</code><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:Consola=
s;color:black;background:#ECECEC">document</span></span><code><span style=
=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> <=
/span></code><span class=3D"o"><span style=3D"font-size:8.0pt;font-family:C=
onsolas;color:black;background:#ECECEC">=3D</span></span><code><span style=
=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> <=
/span></code><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:C=
onsolas;color:black;background:#ECECEC">saxon_processor</span></span><span =
class=3D"p"><span style=3D"font-size:8.0pt;font-family:Consolas;color:black=
;background:#ECECEC">.</span></span><span class=3D"n"><span style=3D"font-s=
ize:8.0pt;font-family:Consolas;color:black;background:#ECECEC">parse_xml</s=
pan></span><span class=3D"p"><span style=3D"font-size:8.0pt;font-family:Con=
solas;color:black;background:#ECECEC">(</span></span><span class=3D"n"><spa=
n style=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECE=
CEC">xml_text</span></span><span class=3D"o"><span style=3D"font-size:8.0pt=
;font-family:Consolas;color:black;background:#ECECEC">=3D</span></span><spa=
n class=3D"s"><span style=3D"font-size:8.0pt;font-family:Consolas;color:bla=
ck;background:#ECECEC">&quot;&lt;request&gt;&lt;/request&gt;&quot;</span></=
span><span class=3D"p"><span style=3D"font-size:8.0pt;font-family:Consolas;=
color:black;background:#ECECEC">)</span></span><code><span style=3D"font-si=
ze:8.0pt;font-family:Consolas;background:#ECECEC"><o:p></o:p></span></code>=
</pre>
<pre style=3D"background:#ECECEC"><code><span style=3D"font-size:8.0pt;font=
-family:Consolas;color:black;background:#ECECEC">&nbsp;&nbsp;&nbsp; </span>=
</code><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:Consola=
s;color:black;background:#ECECEC">executable</span></span><code><span style=
=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> <=
/span></code><span class=3D"o"><span style=3D"font-size:8.0pt;font-family:C=
onsolas;color:black;background:#ECECEC">=3D</span></span><code><span style=
=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> <=
/span></code><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:C=
onsolas;color:black;background:#ECECEC">xslt_proc</span></span><span class=
=3D"p"><span style=3D"font-size:8.0pt;font-family:Consolas;color:black;back=
ground:#ECECEC">.</span></span><span class=3D"n"><span style=3D"font-size:8=
.0pt;font-family:Consolas;color:black;background:#ECECEC">compile_styleshee=
t</span></span><span class=3D"p"><span style=3D"font-size:8.0pt;font-family=
:Consolas;color:black;background:#ECECEC">(</span></span><span class=3D"n">=
<span style=3D"font-size:8.0pt;font-family:Consolas;color:black;background:=
#ECECEC">stylesheet_file</span></span><span class=3D"o"><span style=3D"font=
-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">=3D</span>=
</span><span class=3D"s"><span style=3D"font-size:8.0pt;font-family:Consola=
s;color:black;background:#ECECEC">&quot;transforms/QuoteRequest-sample.xslt=
&quot;</span></span><span class=3D"p"><span style=3D"font-size:8.0pt;font-f=
amily:Consolas;color:black;background:#ECECEC">)</span></span><code><span s=
tyle=3D"font-size:8.0pt;font-family:Consolas;background:#ECECEC"><o:p></o:p=
></span></code></pre>
<pre style=3D"background:#ECECEC"><code><span style=3D"font-size:8.0pt;font=
-family:Consolas;background:#ECECEC"><o:p>&nbsp;</o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><code><span style=3D"font-size:8.0pt;font=
-family:Consolas;color:black;background:#ECECEC">&nbsp;&nbsp;&nbsp; </span>=
</code><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:Consola=
s;color:black;background:#ECECEC">values</span></span><code><span style=3D"=
font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> </spa=
n></code><span class=3D"o"><span style=3D"font-size:8.0pt;font-family:Conso=
las;color:black;background:#ECECEC">=3D</span></span><code><span style=3D"f=
ont-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> </span=
></code><span class=3D"nb"><span style=3D"font-size:8.0pt;font-family:Conso=
las;color:black;background:#ECECEC">range</span></span><span class=3D"p"><s=
pan style=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#E=
CECEC">(</span></span><span class=3D"mi"><span style=3D"font-size:8.0pt;fon=
t-family:Consolas;color:black;background:#ECECEC">1000</span></span><span c=
lass=3D"p"><span style=3D"font-size:8.0pt;font-family:Consolas;color:black;=
background:#ECECEC">)</span></span><code><span style=3D"font-size:8.0pt;fon=
t-family:Consolas;background:#ECECEC"><o:p></o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><code><span style=3D"font-size:8.0pt;font=
-family:Consolas;color:black;background:#ECECEC">&nbsp;&nbsp;&nbsp; </span>=
</code><span class=3D"k"><span style=3D"font-size:8.0pt;font-family:Consola=
s;color:black;background:#ECECEC">for</span></span><code><span style=3D"fon=
t-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> </span><=
/code><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:Consolas=
;color:black;background:#ECECEC">i</span></span><code><span style=3D"font-s=
ize:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> </span></co=
de><span class=3D"ow"><span style=3D"font-size:8.0pt;font-family:Consolas;c=
olor:black;background:#ECECEC">in</span></span><code><span style=3D"font-si=
ze:8.0pt;font-family:Consolas;color:black;background:#ECECEC"> </span></cod=
e><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:Consolas;col=
or:black;background:#ECECEC">values</span></span><span class=3D"p"><span st=
yle=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC"=
>:</span></span><code><span style=3D"font-size:8.0pt;font-family:Consolas;b=
ackground:#ECECEC"><o:p></o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><code><span style=3D"font-size:8.0pt;font=
-family:Consolas;color:black;background:#ECECEC">&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></code><span class=3D"n"><s=
pan style=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#E=
CECEC">executable</span></span><span class=3D"p"><span style=3D"font-size:8=
.0pt;font-family:Consolas;color:black;background:#ECECEC">.</span></span><s=
pan class=3D"n"><span style=3D"font-size:8.0pt;font-family:Consolas;color:b=
lack;background:#ECECEC">transform_to_string</span></span><span class=3D"p"=
><span style=3D"font-size:8.0pt;font-family:Consolas;color:black;background=
:#ECECEC">(</span></span><span class=3D"n"><span style=3D"font-size:8.0pt;f=
ont-family:Consolas;color:black;background:#ECECEC">xdm_node</span></span><=
span class=3D"o"><span style=3D"font-size:8.0pt;font-family:Consolas;color:=
black;background:#ECECEC">=3D</span></span><span class=3D"n"><span style=3D=
"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">docum=
ent</span></span><span class=3D"p"><span style=3D"font-size:8.0pt;font-fami=
ly:Consolas;color:black;background:#ECECEC">)</span></span><code><span styl=
e=3D"font-size:8.0pt;font-family:Consolas;background:#ECECEC"><o:p></o:p></=
span></code></pre>
<pre style=3D"background:#ECECEC"><code><span style=3D"font-size:8.0pt;font=
-family:Consolas;color:black;background:#ECECEC">&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></code><span class=3D"k"><s=
pan style=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#E=
CECEC">print</span></span><span class=3D"p"><span style=3D"font-size:8.0pt;=
font-family:Consolas;color:black;background:#ECECEC">(</span></span><span c=
lass=3D"n"><span style=3D"font-size:8.0pt;font-family:Consolas;color:black;=
background:#ECECEC">process</span></span><span class=3D"p"><span style=3D"f=
ont-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">.</span=
></span><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:Consol=
as;color:black;background:#ECECEC">memory_info</span></span><span class=3D"=
p"><span style=3D"font-size:8.0pt;font-family:Consolas;color:black;backgrou=
nd:#ECECEC">().</span></span><span class=3D"n"><span style=3D"font-size:8.0=
pt;font-family:Consolas;color:black;background:#ECECEC">rss</span></span><s=
pan class=3D"p"><span style=3D"font-size:8.0pt;font-family:Consolas;color:b=
lack;background:#ECECEC">)</span></span><code><span style=3D"font-size:8.0p=
t;font-family:Consolas;background:#ECECEC"><o:p></o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><code><span style=3D"font-size:8.0pt;font=
-family:Consolas;background:#ECECEC"><o:p>&nbsp;</o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><span class=3D"n"><span style=3D"font-siz=
e:8.0pt;font-family:Consolas;color:black;background:#ECECEC">end_process</s=
pan></span><code><span style=3D"font-size:8.0pt;font-family:Consolas;color:=
black;background:#ECECEC"> </span></code><span class=3D"o"><span style=3D"f=
ont-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">=3D</sp=
an></span><code><span style=3D"font-size:8.0pt;font-family:Consolas;color:b=
lack;background:#ECECEC"> </span></code><span class=3D"n"><span style=3D"fo=
nt-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">psutil</=
span></span><span class=3D"p"><span style=3D"font-size:8.0pt;font-family:Co=
nsolas;color:black;background:#ECECEC">.</span></span><span class=3D"n"><sp=
an style=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#EC=
ECEC">Process</span></span><span class=3D"p"><span style=3D"font-size:8.0pt=
;font-family:Consolas;color:black;background:#ECECEC">()</span></span><code=
><span style=3D"font-size:8.0pt;font-family:Consolas;background:#ECECEC"><o=
:p></o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><span class=3D"k"><span style=3D"font-siz=
e:8.0pt;font-family:Consolas;color:black;background:#ECECEC">print</span></=
span><span class=3D"p"><span style=3D"font-size:8.0pt;font-family:Consolas;=
color:black;background:#ECECEC">(</span></span><span class=3D"s"><span styl=
e=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">&=
quot;Start memory:&quot;</span></span><span class=3D"p"><span style=3D"font=
-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">)</span></=
span><code><span style=3D"font-size:8.0pt;font-family:Consolas;background:#=
ECECEC"><o:p></o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><span class=3D"k"><span style=3D"font-siz=
e:8.0pt;font-family:Consolas;color:black;background:#ECECEC">print</span></=
span><span class=3D"p"><span style=3D"font-size:8.0pt;font-family:Consolas;=
color:black;background:#ECECEC">(</span></span><span class=3D"n"><span styl=
e=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">s=
tart_memory</span></span><span class=3D"p"><span style=3D"font-size:8.0pt;f=
ont-family:Consolas;color:black;background:#ECECEC">)</span></span><code><s=
pan style=3D"font-size:8.0pt;font-family:Consolas;background:#ECECEC"><o:p>=
</o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><span class=3D"k"><span style=3D"font-siz=
e:8.0pt;font-family:Consolas;color:black;background:#ECECEC">print</span></=
span><span class=3D"p"><span style=3D"font-size:8.0pt;font-family:Consolas;=
color:black;background:#ECECEC">(</span></span><span class=3D"s"><span styl=
e=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">&=
quot;End memory:&quot;</span></span><span class=3D"p"><span style=3D"font-s=
ize:8.0pt;font-family:Consolas;color:black;background:#ECECEC">)</span></sp=
an><code><span style=3D"font-size:8.0pt;font-family:Consolas;background:#EC=
ECEC"><o:p></o:p></span></code></pre>
<pre style=3D"background:#ECECEC"><span class=3D"k"><span style=3D"font-siz=
e:8.0pt;font-family:Consolas;color:black;background:#ECECEC">print</span></=
span><span class=3D"p"><span style=3D"font-size:8.0pt;font-family:Consolas;=
color:black;background:#ECECEC">(</span></span><span class=3D"n"><span styl=
e=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">p=
rocess</span></span><span class=3D"p"><span style=3D"font-size:8.0pt;font-f=
amily:Consolas;color:black;background:#ECECEC">.</span></span><span class=
=3D"n"><span style=3D"font-size:8.0pt;font-family:Consolas;color:black;back=
ground:#ECECEC">memory_info</span></span><span class=3D"p"><span style=3D"f=
ont-size:8.0pt;font-family:Consolas;color:black;background:#ECECEC">().</sp=
an></span><span class=3D"n"><span style=3D"font-size:8.0pt;font-family:Cons=
olas;color:black;background:#ECECEC">rss</span></span><span class=3D"p"><sp=
an style=3D"font-size:8.0pt;font-family:Consolas;color:black;background:#EC=
ECEC">)</span></span><code><span style=3D"font-size:8.0pt;font-family:Conso=
las;background:#ECECEC"><o:p></o:p></span></code></pre>
<p>If you comment out all of the Saxon code then you will see the memory do=
es not increase. If you move most of it out of the for loop, so it's only c=
alled once, and only have the
<code><span style=3D"font-size:9.5pt;font-family:Consolas;color:black;backg=
round:#ECECEC">transform_to_string</span></code> function in the loop then =
the memory still increases.<o:p></o:p></p>
<p>What is cause the memory to be locked? How can I release it so it can be=
used in an AWS lambda with 100s and 1000s of requests?<o:p></o:p></p>
</td>
</tr>
<tr>
<td width=3D"100%" style=3D"width:100.0%;padding:0cm 0cm 0cm 0cm">
<div class=3D"MsoNormal" align=3D"center" style=3D"mso-margin-top-alt:14.4p=
t;margin-right:0cm;margin-bottom:14.4pt;margin-left:0cm;text-align:center">
<span style=3D"font-size:9.0pt">
<hr size=3D"0" width=3D"100%" align=3D"center">
</span></div>
<p><span style=3D"font-size:9.0pt">You have received this notification beca=
use you have either subscribed to or are involved in a project on Saxonica =
Developer Community site. To change your notification preferences, please c=
lick here:
<a href=3D"https://saxonica.plan.io/my/account?tour=3Dmail_preferences">htt=
ps://saxonica.plan.io/my/account?tour=3Dmail_preferences</a><o:p></o:p></sp=
an></p>
</td>
</tr>
<tr>
<td width=3D"100%" style=3D"width:100.0%;padding:0cm 0cm 0cm 0cm">
<p class=3D"MsoNormal" align=3D"center" style=3D"text-align:center"><span s=
tyle=3D"font-size:13.0pt;font-family:Helvetica;color:#D7D7D7"><o:p>&nbsp;</=
o:p></span></p>
<div>
<p class=3D"MsoNormal" align=3D"center" style=3D"text-align:center"><span s=
tyle=3D"font-size:13.0pt;font-family:Helvetica;color:#D7D7D7"><a href=3D"ht=
tps://plan.io/"><span style=3D"color:#D7D7D7;text-decoration:none">This not=
ification was cheerfully delivered by</span></a><o:p></o:p></span></p>
</div>
</td>
</tr>
<tr>
<td width=3D"100%" style=3D"width:100.0%;padding:0cm 0cm 0cm 0cm">
<p class=3D"MsoNormal" align=3D"center" style=3D"text-align:center"><a href=
=3D"https://plan.io/" title=3D"&quot;Planio&quot; "><span style=3D"font-siz=
e:11.0pt;color:windowtext;text-decoration:none"><span style=3D"color:#0088B=
7"><img border=3D"0" width=3D"102" height=3D"25" style=3D"width:1.0625in;he=
ight:.2604in" id=3D"_x0000_i1025" src=3D"https://assets.plan.io/images/plan=
io_logo_gray_204x50.png" alt=3D"Planio"></span></span></a><span style=3D"fo=
nt-size:11.0pt"><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p>&nbsp;</o:p></=
span></p>
</div>
<div><a href=3D"https://www.cdl.co.uk/media/newsletter.html"><img src=3D"ht=
tps://www.cdl.co.uk/assets/site-wide/social-newshub-icon.jpeg" hspace=3D"2"=
height=3D"50" margin-right=3D"3" width=3D"275" border=3D"0"></a><a href=3D=
"https://www.cdl.co.uk/careers/vacancies.html"><img src=3D"https://www.cdl.=
co.uk/assets/site-wide/social-vacancy-icon.png" hspace=3D"2" height=3D"50" =
margin-right=3D"3" width=3D"50" border=3D"0"></a><a href=3D"http://twitter.=
com/CDL_Software"><img src=3D"https://www.cdl.co.uk/assets/site-wide/social=
-twitter-icon.png" hspace=3D"2" height=3D"50" width=3D"50" margin-right=3D"=
3" border=3D"0"></a><a href=3D"http://www.linkedin.com/company/cdl-cheshire=
-datasystems-ltd-"><img src=3D"https://www.cdl.co.uk/assets/site-wide/socia=
l-linkedin-icon.png" hspace=3D"2" height=3D"50" width=3D"50" margin-right=
=3D"3" border=3D"0"></a><a href=3D"https://en-gb.facebook.com/CDLSoftware">=
<img src=3D"https://www.cdl.co.uk/assets/site-wide/social-facebook-icon.png=
" hspace=3D"2" height=3D"50" width=3D"50" border=3D"0"></a>
</div>
<div class=3D"MsoNormal" align=3D"center" style=3D"text-align:center"><span=
style=3D"font-size:8.5pt;font-family:&quot;Arial&quot;,sans-serif;mso-fare=
ast-language:EN-GB">
<hr size=3D"2" width=3D"100%" align=3D"center">
</span></div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:8.5pt;font-family:&quot;Ari=
al&quot;,sans-serif;mso-fareast-language:EN-GB"><br>
Please consider the environment - Do you really need to print this email? <=
/span>
</p>
<p><span style=3D"font-size:8.5pt;font-family:&quot;Arial&quot;,sans-serif"=
>This email is intended only for the person(s) named above and may contain =
private and confidential information. If it has come to you in error, pleas=
e destroy and permanently delete any copy in
your possession, and contact us on +44 (0)161 480 4420. The information in=
this email is copyright &copy; CDL Group Holdings Limited. We cannot accep=
t liability for any loss or damage sustained as a result of software viruse=
s. It is your responsibility to carry
out such virus checking as is necessary before opening any attachment.</sp=
an></p>
<p><span style=3D"font-size:8.5pt;font-family:&quot;Arial&quot;,sans-serif"=
>Cheshire Datasystems Limited uses software which automatically screens inc=
oming emails for inappropriate content and attachments. If the software ide=
ntifies such content or attachment, the email
will be forwarded to our Technology department for checking. You should be=
aware that any email that you send to Cheshire Datasystems Limited is subj=
ect to this procedure.
</span></p>
<div class=3D"MsoNormal" align=3D"center" style=3D"text-align:center"><span=
style=3D"font-size:8.5pt;font-family:&quot;Arial&quot;,sans-serif;mso-fare=
ast-language:EN-GB">
<hr size=3D"2" width=3D"100%" align=3D"center">
</span></div>
<p class=3D"MsoNormal"><strong><span style=3D"font-size:8.5pt;font-family:&=
quot;Arial&quot;,sans-serif;mso-fareast-language:EN-GB">Cheshire Datasystem=
s Limited, Strata House, Kings Reach Road, Stockport, SK4 2HD</span></stron=
g><span style=3D"font-size:8.5pt;font-family:&quot;Arial&quot;,sans-serif;m=
so-fareast-language:EN-GB"><br>
Registered in England and Wales with company number 3991057<br>
VAT registration: 727 1188 33</span></p>
</div>
<br>
<p style=3D"font-family:Calibri;font-size:10pt;color:#000000;margin:5pt;" a=
lign=3D"Center">
CDL - EXTERNAL<br>
</p>
</body>
</html>

--_000_CWLP123MB513609D3C1FC3C1965C46F9EB0799CWLP123MB5136GBRP_--
    (1-1/1)