Git Product home page Git Product logo

Comments (7)

eliaslevy avatar eliaslevy commented on May 31, 2024

Here is a thread that discusses this issue.

from hyperscan-java.

eliaslevy avatar eliaslevy commented on May 31, 2024

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.

gliwka avatar gliwka commented on May 31, 2024

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.

gliwka avatar gliwka commented on May 31, 2024
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.

gliwka avatar gliwka commented on May 31, 2024

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.

gliwka avatar gliwka commented on May 31, 2024

Fixed in v0.4.11

from hyperscan-java.

eliaslevy avatar eliaslevy commented on May 31, 2024

πŸ‘

from hyperscan-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.