pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrea Vacondio <andrea.vacon...@gmail.com>
Subject Mutable COSInteger
Date Fri, 13 Feb 2015 11:48:22 GMT
I was looking at the COSInteger and I have a couple of questions.
I noticed that it caches instances between in -100 and 265.
My first question is why those limits and not cache everything... perhaps
with Soft or Weak values? I made a very rough test using a Map to cache all
the COSInteger and I loaded the 32MB pdf_reference_1-7.pdf, it saved a
couple of MB of memory and about 130k COSInteger instances, not much but
still... Is there any reason I'm missing for those limits?
Second question. They are cached and they are mutable so this:
        COSInteger cosint = COSInteger.get(10);
        //lets move to a totally unrelated part of my software

prints COS{50} so basically I ask for a 10 and get a 50, isn't it weird
(and error prone)? ... or the way around, I call cosint.setValue(50) at
some point in the software and that makes it a 50 everywhere I used
That's of course also true for the other mutable attributes setDirect and

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message