Skip to content

Commit

Permalink
chore: test added for memory allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobshirley committed Mar 14, 2024
1 parent f75011f commit c350b62
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/MemorySafe.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { expect } from 'chai';
import { importClass, ensureJvm } from '../.';

ensureJvm({
opts: [
'-Xms512m',
'-Xmx512m'
],
})

describe('MemorySafe tests', () => {
it('should allow 1000 instances of java.io.ByteArrayInputStream', () => {
const ByteArrayInputStream = importClass('java.io.ByteArrayInputStream');
const buffer = Buffer.alloc(1024 * 1024);

for (let i = 0; i < 200000; i++) {
const stream = new ByteArrayInputStream(buffer);
expect(stream).to.be.an('object');
}
})
})

0 comments on commit c350b62

Please sign in to comment.