JCash / voronoi

A C implementation for creating 2D voronoi diagrams
MIT License
638 stars 94 forks source link

memory crash #82

Closed YoungCapta1n closed 1 year ago

YoungCapta1n commented 1 year ago

Love your library and it is very efficient. I run the jcv_diagram_generate from the following points: 13.500000, 4.000000 8.500000, 0.000000 13.500000, 3.500000 8.500000, 0.500000 13.500000, 3.000000 8.500000, 1.000000 13.500000, 2.500000 8.500000, 1.500000 13.500000, 2.000000 8.500000, 2.000000 13.500000, 1.500000 8.500000, 2.500000 13.500000, 1.000000 8.500000, 3.000000 13.500000, 0.500000 8.500000, 3.500000 13.500000, 0.000000 8.500000, 4.000000 13.000000, 0.000000 9.000000, 4.000000 12.500000, 0.000000 9.500000, 4.000000 12.000000, 0.000000 10.000000, 4.000000 11.500000, 0.000000 10.500000, 4.000000 11.000000, 0.000000 11.000000, 4.000000 10.500000, 0.000000 11.500000, 4.000000 10.000000, 0.000000 12.000000, 4.000000 9.500000, 0.000000 12.500000, 4.000000 9.000000, 0.000000 13.000000, 4.000000

However, it results in the memory crash and I want to figure out the reason.

JCash commented 1 year ago

Hi @YoungCapta1n !

Thanks, that's nice to hear!

I just tested your data, but I couldn't reproduce the crash. I used this file testdata_issue82.txt like so:

$ main -i testdata_issue82.txt

And it produced the example.png: image

Do you have a callstack from the crash? E.g. if you run the code through your debugger? Which platform are you using?

Are you building the library with any settings I should build with?

YoungCapta1n commented 1 year ago

I also tested the data using the jc_voronoi.h alone, and get the good results. (on Ubuntu 22.04) Screenshot from 2023-05-25 17-31-14 Maybe the memory crash problem was caused by my code, and I will check it. Thanks!

YoungCapta1n commented 1 year ago

Hi, I use the library with following settings, and the data Screenshot from 2023-05-25 21-33-21

issue82data_error.txt

On ubuntu 22.04 with 16Gb of RAM, It test the library with the above data and come across a large memory consumption. Can you please try again, Thanks!

YoungCapta1n commented 1 year ago

Love your library and it is very efficient. I run the jcv_diagram_generate using Double floating point precision from the following points (On ubuntu 22.04, Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz with 16Gb of RAM) 13.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 0.00000000000000022204460492503130808472633361816406 13.5000000000000000000000000000000000000000, 3.50000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 0.50000000000000022204460492503130808472633361816406 13.5000000000000000000000000000000000000000, 3.00000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 1.00000000000000000000000000000000000000000000000000 13.5000000000000000000000000000000000000000, 2.50000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 1.50000000000000022204460492503130808472633361816406 13.5000000000000000000000000000000000000000, 1.99999999999999977795539507496869191527366638183594 8.5000000000000000000000000000000000000000, 2.00000000000000000000000000000000000000000000000000 13.5000000000000000000000000000000000000000, 1.50000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 2.50000000000000000000000000000000000000000000000000 13.5000000000000000000000000000000000000000, 0.99999999999999977795539507496869191527366638183594 8.5000000000000000000000000000000000000000, 3.00000000000000000000000000000000000000000000000000 13.5000000000000000000000000000000000000000, 0.49999999999999977795539507496869191527366638183594 8.5000000000000000000000000000000000000000, 3.50000000000000000000000000000000000000000000000000 13.5000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 8.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 13.0000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 9.0000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 12.5000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 9.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 12.0000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 10.0000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 11.5000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 10.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 11.0000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 11.0000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 10.5000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 11.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 10.0000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 12.0000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 9.5000000000000000000000000000000000000000, 0.00000000000000000000000000000000000000000000000000 12.5000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 9.0000000000000000000000000000000000000000, 0.00000000000000022204460492503130808472633361816406 13.0000000000000000000000000000000000000000, 4.00000000000000000000000000000000000000000000000000 However, it results in the memory crash and I want to figure out the reason.