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

OutOfMemory Error during routing #297

Open
LimesKey opened this issue Apr 15, 2024 · 8 comments
Open

OutOfMemory Error during routing #297

LimesKey opened this issue Apr 15, 2024 · 8 comments

Comments

@LimesKey
Copy link

LimesKey commented Apr 15, 2024

  • What version of freerouting are you using?
    v1.90.0 (latest)

  • On what platform did you run it? Windows, Linux, MacOS? 32-bit or 64-bit?
    Windows & Arch Linux

  • What EDA do you use? KiCad, KiCad with freerouting plugin, EAGLE, EasyEDA, other? What is its exact version?
    KiCad with freerouting plugin & Standalone

  • What types of files are you working with? Can you attach the project files (.pro, .kicad_pcb, etc) or the exported DSN file? (Please note that GitHub doesn't allow DSN file uploads, so you need to ZIP it before uploading.)
    myboard.zip

  • Did you use any command line arguments?
    No

  • Can you post a screenshot of the problem?
    2024-04-14 19_35_20-Board Layout - Freerouting
    2024-04-15 15_51_09-Mozilla Firefox

  • Can you include the latest, related log entries from the .log file?
    I'm not sure how to by using the KiCad plugin

  • Please list the detailed steps to reproduce the problem
    Freeroute the provided file on a 16GB RAM system

  • What would you expect freerouting to do in this situation?
    Freeroute without errors

  • Is fixing this issue critical for your work?
    Yes

I get "java.lang.OutofMemoryError: java heap space failed reallocation of scalar replaced objects" and "Java.lang.OutofMemoryError: Heap Space". I'm KiCad with the plugin on a laptop with more than 16GB of available RAM, I've also tried running the file on another computer, same result. I've tried increasing my Windows Page File system but no luck.

@LimesKey
Copy link
Author

I tried running the program in Github Codespaces on a 64GB RAM machine but launching the program headless did not work and gave a 'could not find X11 display' error.

@Djzhan0207
Copy link
Contributor

I run this on my windows and mem break too. According to my recent study, when FR can't extend a route, the mem will increase immediately, it relates to its queue data structure.For now, it can't be fixed, you can try another auto-router such as electra.

@andrasfuchs andrasfuchs added this to To do in Freerouting Project Board via automation Apr 16, 2024
@andrasfuchs andrasfuchs added this to the 2.0 milestone Apr 16, 2024
@andrasfuchs
Copy link
Collaborator

I can confirm that this is an issue, thank you @LimesKey for the DSN file.

Here is the profiler's report during my recent session that consumed 8GB of RAM in a matter of minutes:
image

@andrasfuchs
Copy link
Collaborator

I implemented a HashMap-based caching mechanism for some key planar classes to significantly reduce the new object creation count, but it made the algorithm less CPU-efficient because of the thread-safe hash lookups.

image

I will discard these changes, because the memory need didn't decrease significantly in the end.

I think there must be a separate routing issue as well related to your board, that needs further investigation.

@andrasfuchs andrasfuchs modified the milestones: 2.0, Future Apr 16, 2024
@LimesKey
Copy link
Author

Is the bug/issue consider a memory leak or just it working but using up more RAM than intended? I can try it in a Github Codespace with 64GB of RAM if I can solve the headless issue.

I tried Electra last night, and while it was super fast and worked, it conflicted with my graphic on my front copper layer. This is turning into less of a freerouting issues/question, but do you think I would require a third layer because of the complexity of the board? And does anyone know how to prevent the copper graphic from conflciting with the auto routing traces?

@andrasfuchs
Copy link
Collaborator

I think the algorithm gets into to a loop incorrectly that uses up as much memory as it can over time, so in that sense it's a memory leak. It's not dangerous or harmful in any way, it's just that it would probably never finish.

I suspect that it is connected to the fact that your board edge is more complex than other boards, but I might be wrong about that. If you have time you can try to test it with a simple rectangular edge.

I can't help you with Electra unfortunately.

@L1uTongweiNewAccount
Copy link

L1uTongweiNewAccount commented Apr 23, 2024

In fact, I also met this in some of my projects when my RAM is 32GiB and it was NOT full.

Maybe this is infinty recursion or loop made a stack overflow?

I don't know how it works, but I know some silly bug can make this. I found a repetition in my new issue #299.

Although it will not lead the program to crash, but i think it can rellect some issues.

@L1uTongweiNewAccount
Copy link

@andrasfuchs i think this issue is just the bigger issue of #299, and i think if we have more time, we will get the same crash in it.

So to reserch #299, maybe we can fix the bug of memory leak, slow and... anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

4 participants