Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Java bindings throws Out of memory error #308

Closed
2 tasks done
superkelvint opened this issue Nov 11, 2023 · 6 comments
Closed
2 tasks done

Bug: Java bindings throws Out of memory error #308

superkelvint opened this issue Nov 11, 2023 · 6 comments
Assignees
Labels
bug Something isn't working invalid This doesn't seem right released

Comments

@superkelvint
Copy link
Contributor

Describe the bug

Out of memory error with Java bindings.

Steps to reproduce

Follow the Java README code:

Index index = new Index.Config().metric("cos").dimensions(2).build();
float vec[] = {10, 20};
index.add(42, vec);
int[] keys = index.search(vec, 5);

throws this error:

Exception in thread "main" java.lang.Error: Out of memory!
at cloud.unum.usearch.Index.c_add(Native Method)
at cloud.unum.usearch.Index.add(Index.java:107)
at TestUsearch.main(TestUsearch.java:14)

Expected behavior

No error occurs.

USearch version

2.8.10

Operating System

Ubuntu 22.04

Hardware architecture

x86

Which interface are you using?

Other bindings

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@superkelvint superkelvint added bug Something isn't working invalid This doesn't seem right labels Nov 11, 2023
@superkelvint superkelvint changed the title Bug: Java port throws Bug: Java bindings throws Out of memory error Nov 11, 2023
@tducthang
Copy link

I've encountered a similar error too

@ashvardanian
Copy link
Contributor

Thank you, @superkelvint and @ThangTo! Looking into it and will hopefully have a solution tomorrow 🤗

@ashvardanian ashvardanian self-assigned this Nov 12, 2023
ashvardanian pushed a commit that referenced this issue Nov 13, 2023
## [2.8.12](v2.8.11...v2.8.12) (2023-11-13)

### Docs

* Typo in Java README (#307) ([494b9f0](494b9f0)), closes [#307](#307)
* Update Java's step-by-step build instructions (#306) ([63d8027](63d8027)), closes [#306](#306)

### Fix

* Dumping to uninitialized memory in Java ([9eaa10d](9eaa10d))
* Key type mismatch in Java ([25dc6fc](25dc6fc))
* Normalize bit-vector length for SimSIMD (#311) ([8a77b3e](8a77b3e)), closes [#311](#311)
* OOM error in Java ([2589979](2589979)), closes [#308](#308)

### Improve

* TypeScript annotations (#309) ([6a5e009](6a5e009)), closes [#309](#309)

### Make

* Trace used compiler ([7d17eab](7d17eab))
@ashvardanian
Copy link
Contributor

🎉 This issue has been resolved in version 2.8.12 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@tducthang
Copy link

tducthang commented Nov 14, 2023

@ashvardanian Thank you for updating to the new version, everything is ok.
But I want to ask more about how I want to get the "cosine distance" after searching, currently the default is only [keys]
It's difficult without a "distance" result.

@ashvardanian
Copy link
Contributor

@ThangTo, sure, we can change the Java interface to be more similar to other bindings. Any chance you or @superkelvint could contribute? Thank you!

@tducthang
Copy link

@ashvardanian That is currently beyond my ability, I am having difficulty coding C/C++(never coded C/C++ before), can you help me. Haizz
Maybe we need to wait for someone to contribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right released
Projects
None yet
Development

No branches or pull requests

3 participants