errors converting docx files

438 views
Skip to first unread message

Jason Davies

unread,
May 6, 2021, 12:49:19 PM5/6/21
to pandoc-discuss
Hi folks,

I just tried to convert three short Word files one at a time; one worked
fine but two gave errors like this:

pandoc(24405,0x209984e00) malloc: can't allocate region
:*** mach_vm_map(size=1048576, flags: 100) failed (error code=268435465)
pandoc(24405,0x209984e00) malloc: *** set a breakpoint in
malloc_error_break to debug
pandoc: pdflatex: createProcess: runInteractiveProcess: exec: resource
exhausted (Cannot allocate memory)


I'm completely out of my depth here; does this seem to suggest the files
are quirky or is it a pandoc issue (which I could more usefully report)?

Running an M1 Mac Mini on 11.3 and just reinstalled pandoc (March 20,
2021 is the user guide date).

Thanks for any suggestions.

Cheers,

Jason

John MacFarlane

unread,
May 6, 2021, 7:22:09 PM5/6/21
to Jason Davies, pandoc-discuss

You're converting to PDF, I gather. Do any conversions to other
formats cause problems? If it is just PDF, the problem is likely
due to the step where pandoc runs pdflatex on an intermediate
tex file. That is also suggested by the error message
itself. But I'm mystified as to what the problem is, exactly.
ANd I don't have an M1 mac to test on. Can anyone else reproduce
this?
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/274588F4-8776-42E2-A982-3B8FAA3472C2%40gmail.com.

BPJ

unread,
May 7, 2021, 1:34:21 PM5/7/21
to pandoc-discuss, Jason Davies
Is --pdf-engine=xelatex helpful?

The LaTeX runs will take longer though.

Philipp

unread,
May 16, 2021, 10:19:35 AM5/16/21
to pandoc-discuss
I'm afraid I don't know the cause or solution of this problem, but I do encounter the same error from time to time when trying to create beamer slides with pandoc from markdown (using XeTeX).
Two things might be of interest: First, iirc, the problem first occurred after one of the latest macOS updates (I think it was the update to 11.3 and not 11.3.1, but I'm not entirely sure). Second, the problem only occurs from time to time. Most of the time, building the slides works fine. Even if it occurs, a second run directly afterwards normally succeeds.
Unfortunately, I wasn't able to reproduce the problem up to now.

Julio Vera

unread,
May 28, 2021, 3:57:48 PM5/28/21
to pandoc-discuss
Hi I just want to say same thing is happening to me. 

MacBook Air M1 16GB RAM with macOS Big Sur 11.4.

I'm trying to convert a .md to beamer slides using the following command:

pandoc -t beamer -s presproy.md -o prespoy.pdf

I have to try it like 10 times or more until I get the pdf.


John MacFarlane

unread,
Jun 9, 2021, 11:40:37 AM6/9/21
to Jason Davies, pandoc-discuss
"Jason Davies" <ophi...@gmail.com> writes:

> Hi folks,
>
> I just tried to convert three short Word files one at a time; one worked
> fine but two gave errors like this:
>
> pandoc(24405,0x209984e00) malloc: can't allocate region
> :*** mach_vm_map(size=1048576, flags: 100) failed (error code=268435465)
> pandoc(24405,0x209984e00) malloc: *** set a breakpoint in
> malloc_error_break to debug
> pandoc: pdflatex: createProcess: runInteractiveProcess: exec: resource
> exhausted (Cannot allocate memory)
>

I just got an M1 mac, and I ran into this same error.

I found that if I fully specify the pdflatex path, it works:

pandoc -o my.pdf --pdf-engine=/Library/TeX/texbin/pdflatex

It's a bit mysterious why this should be needed, since
`which pdflatex` returns this path!
And running pandoc with --verbose shows that the PATH is
correctly passed through to the process running pdflatex.

Anyone have any ideas? AT least this gives a workaround...

Allan Kelly

unread,
Jul 23, 2021, 10:53:16 AM7/23/21
to pandoc-discuss
Great to find this posting.

I've been having this problem ever since I got a M1 MacBook Air with BigSur at the start of the year.

I couldn't find any references when I encountered it and put it down to something to do with BigSur and ARM.
I've reinstalled Pandoc and PdfLatex several time but never resolved.
I've just don't another reinstall and then stumbled on John's fix which works for me - thanks!

Something I noticed in the process: a really small file will process correctly:

# Hello world

## Hello world

### Hello world

Hello world

pandoc hello.txt -o hello.pdf

Works.
You can add a few more paragraphs (approx 5) to hello.txt before I get the error - which hints that there is some actual resource exhausted happening. But why would that be fixed by specifying the path? Dunno.

Thanks for the fix, hope we can find a solution before long

allan

Lewis Westbury

unread,
Jul 25, 2021, 11:22:06 AM7/25/21
to pandoc-discuss
I appreciate this isn't the simple solution that you might be hoping for, but I've had success in getting pandoc to run reliably in a docker container.

I'm using it to build my thesis, and I created a template project here https://github.com/instantiator/markdown-thesis-builder which contains a sample Dockerfile, and the build script that uses pandoc.

I hope it's helpful - I found it's the only way to reliably run pandoc on my M1 Mac.

SlyFox

unread,
Aug 1, 2021, 2:16:10 PM8/1/21
to pandoc-discuss
M1 Mac. 

I tried this:for f in *.md; do pandoc "$f" -o "${f%.md}.pdf"; done

But I get an error:

pandoc(45574,0x207810e00) malloc: *** set a breakpoint in malloc_error_break to debug

pandoc: pdflatex: createProcess: runInteractiveProcess: exec: resource exhausted (Cannot allocate memory)

SlyFox

unread,
Aug 1, 2021, 2:19:59 PM8/1/21
to pandoc-discuss
So how do you combine the two commands to batch convert?

for f in *.md; do pandoc "$f" -s -o "${f%.txt}.pdf"; done

--pdf-engine=/Library/TeX/texbin/pdflatex

John MacFarlane

unread,
Aug 1, 2021, 6:15:33 PM8/1/21
to SlyFox, pandoc-discuss

for f in *.md; do pandoc --pdf-engine=/Library/TeX/texbin/pdflatex "$f" -s -o "${f%.txt}.pdf"; done
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/c70c1da4-1ec9-4d34-aed3-7abf1c689adan%40googlegroups.com.

SlyFox

unread,
Aug 2, 2021, 4:31:05 AM8/2/21
to pandoc-discuss
This works! Thank you!
Reply all
Reply to author
Forward
0 new messages