0

Ok i am trying to decode a base64 encoded rtf doc in MarkLogic.

xquery version "1.0-ml";

declare namespace cdm = "http://example.nl/cdm/1.2";

let $inh := <cdm:inhoud>

Large base64  encoded RTF doc here

</cdm:inhoud>
let $pv           := $inh/text()
(:
let $decodedDoc   := document {xdmp:document-filter( text{ xdmp:base64-decode($pv) } )}
:)
return document {xdmp:document-filter( text{ xdmp:base64-decode($pv) } )}

I get this error:

 SVC-PROCESSRUN: xdmp:document-filter(text{"{\rtf1\ansi\ansicpg1252\uc1\deff1{\fonttbl&#13;&#10;{\f0\fnil\fc..."}) -- Process run error: fork: Cannot allocate memory

Running only

xdmp:base64-decode($pv)

Decodes the rtf file but really messy...

Does my server have not enough memory?

grtjn
  • 20,254
  • 1
  • 24
  • 35
Hugo Koopmans
  • 1,349
  • 1
  • 15
  • 27
  • the issue is gone now, decoding works again. no clue what caused this... could a really big error.txt logfile have anything to do with it? – Hugo Koopmans Oct 15 '15 at 02:27

1 Answers1

0

I think the problem is mostly that you force MarkLogic to keep the entire decoded string as well as the filtered result in memory. It would help if you wouldn't need to decode inside this code, and search a doc or request body directly into document-filter. Also don't wrap document-filter result inside a document constructor. It already returns a document node.

HTH!

grtjn
  • 20,254
  • 1
  • 24
  • 35