summaryrefslogtreecommitdiffhomepage
path: root/test/tc_package.rb
diff options
context:
space:
mode:
authorVladimir Kochnev <[email protected]>2016-08-03 12:09:19 +0300
committerVladimir Kochnev <[email protected]>2019-10-02 18:06:35 +0300
commit913003eaf0456e4645cad91f2622354deae10841 (patch)
tree27293f11b37df246eaf15da6a062bbfade8882bb /test/tc_package.rb
parentc73b36d80f6a07862ead30a593f62b4797926110 (diff)
downloadcaxlsx-913003eaf0456e4645cad91f2622354deae10841.tar.gz
caxlsx-913003eaf0456e4645cad91f2622354deae10841.zip
Fix Relationship.instances cache.
This PR aims to fix several issues with Relationship cache: 1) It's not threadsafe, so I propose to use a TLS variable for this. 2) Memory obtained by cache remains non-freed before the next run of `serialize`. I think it should be freed immediately. 3) Memory should be freed in `ensure` block to prevent memory bloating in case of exception. *There are only two hard things in Computer Science: cache invalidation and naming things.*
Diffstat (limited to 'test/tc_package.rb')
-rw-r--r--test/tc_package.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/tc_package.rb b/test/tc_package.rb
index d89f35b0..4bd0d429 100644
--- a/test/tc_package.rb
+++ b/test/tc_package.rb
@@ -236,6 +236,8 @@ class TestPackage < Test::Unit::TestCase
# this is just a roundabout guess for a package as it is build now
# in testing.
assert(stream.size > 80000)
+ # Cached instances should be cleared
+ assert(Axlsx::Relationship.instances.empty?)
end
def test_encrypt