Comments (7)
Here is a thread that discusses this issue.
from hyperscan-java.
Not that the problem is not Expression.validate
per se, but calls to hs_free_compile_error
, which also occur in Database.handleErrors
.
from hyperscan-java.
Yeah, thats true.
I was able to reproduce it.
Basically it boils down to:
a) disabling autoread on the structs and freeing the structs using hs_free_compile_error
or
b) not freeing the struct and leaving it to the garbage collector, since the JNA implementation should take care of it
from hyperscan-java.
hs_error_t HS_CDECL hs_free_compile_error(hs_compile_error_t *error) {
#if defined(FAT_RUNTIME)
if (!check_ssse3()) {
return HS_ARCH_ERROR;
}
#endif
freeCompileError(error);
return HS_SUCCESS;
}
That's the implementation of the hs_free_compile_error. In case it's a "fat library" (supporting multiple instruction sets), it makes sure at least sse3 is available. After that it calls freeCompileError(error), which is implemented as:
void freeCompileError(hs_compile_error_t *error) {
if (!error) {
return;
}
if (error == &hs_enomem || error == &hs_einternal ||
error == &hs_badalloc) {
// These are not allocated.
return;
}
hs_misc_free(error->message);
hs_misc_free(error);
}
hs_misc_free then just calls the default deallocator for the platform (free) or in case a user provided hyperscan with their own deallocator by using hs_set_misc_allocator() it then uses that.
from hyperscan-java.
Since the memory is not allocated by JNA, it seems like it won't free the memory on garbage collection, so "disabling autoread on the structs and freeing the structs using hs_free_compile_error" is the proper solution.
I'm testing it right now and will push it later.
from hyperscan-java.
Fixed in v0.4.11
from hyperscan-java.
π
from hyperscan-java.
Related Issues (20)
- logical combination of expressions HOT 6
- ε¦δ½ε¨windowsδΈθ°θ― HOT 2
- how to build libhs.so? HOT 2
- Native lib not loading on macos HOT 1
- Support for Chimera HOT 5
- java.lang.UnsatisfiedLinkError: no jnihyperscan in java.library.path HOT 6
- Class Not Found Exception HOT 1
- Apple Silicon support HOT 10
- ERROR :- There can only be 256 non-closed Scanner instances. Create them once per thread! HOT 4
- The Scanner.class has a bug HOT 1
- java.lang.OutOfMemoryError: Cannot allocate new PointerPointer(13): totalBytes = 0, physicalBytes = 8085M\n\tat org.bytedeco.javacpp.PointerPointer.<init>(PointerPointer.java:149)\n\tat com.gliwka.hyperscan.wrapper.Database.compile(Database.java:83) HOT 1
- Migrate to project panama
- Race condition in Scanner ctor HOT 1
- Database instances not reclaimable by GC HOT 2
- Allow arbitrary expression IDs
- The library should cleanup memory garbage after itself. HOT 3
- NullPointerException: null HOT 1
- Scanner.scan utf8ByteIndexesMapping Array Out Of Bounds HOT 4
- Memory leak in the PatternFilter HOT 2
- Any plans to support linux_arm in the future? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hyperscan-java.