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

PhysiCell::Cell_Definition possibly memory leaking #263

Open
elmbeech opened this issue Jun 28, 2024 · 2 comments
Open

PhysiCell::Cell_Definition possibly memory leaking #263

elmbeech opened this issue Jun 28, 2024 · 2 comments

Comments

@elmbeech
Copy link
Contributor

I get a Segmentation fault (core dumped), if I try to generate a second instance of a Cell_Definition.
Reading up on this, this potentially points to a memory leaking.

Minimal example:

  1. rest to a fresh PhysiCell installation.
make clean reset
make template
  1. add the following line to custom_modules/custome.cpp.
PhysiCell::Cell_Definition cell_defaults_two;
  1. compile and run the template project.
make 
./project

I will have to study the code in deep and use a debugger to resolve this issue.

@rheiland
Copy link
Collaborator

Your reason for wanting to create a second instance of a Cell_Definition escapes me, but just as an academic exercise, I took a closer look and created a repo to demonstrate. Do NOT do a make reset, just make and run project. Take a look at the modified/simplified main.cpp and the custom.cpp. Bottom line: the cell_defaults instance (in core/PhysiCell_cell.cpp) is quite special and has a long history which includes how cell definitions have evolved. Nevertheless, hopefully this repo is instructive: https://github.com/rheiland/second_cell_defaults_instance

Having said that, yes, I encourage you (and anyone else) to use a debugger to track down where segfaults occur. In this case, it's not a memory leak.

@elmbeech
Copy link
Contributor Author

elmbeech commented Oct 27, 2024

this is very helpful!

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

2 participants