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

extend materials segfaults #32

Open
gridley opened this issue May 9, 2023 · 0 comments
Open

extend materials segfaults #32

gridley opened this issue May 9, 2023 · 0 comments

Comments

@gridley
Copy link

gridley commented May 9, 2023

Material* tmp = static_cast<Material*>(malloc(n * sizeof(Material)));

You can see that this segfaults pretty straightforwardly. It mallocs n materials, but we actually need materials_size + n.

If we let this sit for a bit, I have an implementation coming that fixes this and uses std::realloc for potential efficiency improvement. It also makes a few of the commonly used classes trivially copyable. Currently resolving a few other problems.

Lesson learned: in any future GPU-portable implementation, we must avoid managing memory by hand at all costs since it is so error prone.

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

No branches or pull requests

1 participant