1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <sys/resource.h>
#include <stdio.h>
#include "pdfw.h"
/* Linux-only fixture measurement, not a per-process production limit. */
int
main(int argc, char **argv)
{
struct rusage usage;
pdfw *p;
int font, image_rc, close_rc;
if (argc != 4)
return 2;
p = pdfw_open(argv[3]);
if (p == NULL)
return 1;
font = pdfw_font(p, argv[1]);
pdfw_page(p, 595, 842);
pdfw_text(p, font, 12, 20, 800, "Font stays live while PNG is embedded: ₹");
image_rc = pdfw_image(p, argv[2], 20, 200, 500, 500);
close_rc = pdfw_close(p);
if (font == PDFW_HELVETICA || image_rc != 0 || close_rc != 0 ||
getrusage(RUSAGE_SELF, &usage) != 0)
return 1;
printf("native_writer_peak_kib=%ld; fixture_ceiling_kib=24576\n",
usage.ru_maxrss);
if (usage.ru_maxrss <= 0 || usage.ru_maxrss >= 24576) {
fprintf(stderr, "FAIL - writer fixture exceeds its24MiB regression ceiling\n");
return 1;
}
return 0;
}