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

The problem about the MFC interface #22

Open
hushanming opened this issue Dec 20, 2016 · 6 comments
Open

The problem about the MFC interface #22

hushanming opened this issue Dec 20, 2016 · 6 comments

Comments

@hushanming
Copy link

Hi,@mkazhdan
First,thank you for providing the PoissonRecon project.
I recently used your code and made some changes to it.I used the MFC interface to run the code,rather than the console cause I found it will take part of the memory when the end of the operation.So I have some problems.When I first choose the point-set file ,run the code and it run perfectly,however when I choose the file(the same as the first or not)and run the code,it collapsed(I did not withdraw MFC in this process).
I try to debug this code,but I could not find th reason.My compiler is visual studio 2013.Thank you.

@mkazhdan
Copy link
Owner

mkazhdan commented Dec 20, 2016 via email

@hushanming
Copy link
Author

Hi,@mkazhdan
Thank you for your reply,I found the reason is in the code,the SetAllocator is a static function.So the memory would clear after the process finished.But if I want the code continuous operation twice,it would collapsed in the code,because the memory is not released,so the _spaceRoot value would changed after call function.The problem is that I could not change the code in your project? Could you please give me some addvices about this ? Thank you.

@hushanming
Copy link
Author

Hi,@mkazhdan
I'm sorry to bother you,I found there is a memory leak at the code.It has not been released before the end of the progam and it continue to increase when calling this code.
Thank you.

@markloyman
Copy link

Hi @hushanming ,
Did you manage to find a solution for this problem?

@markloyman
Copy link

markloyman commented Oct 10, 2017

If you run Poisson for a second time (note: this has nothing to do with MFC):

Calling OctNode< NodeData >::SetAllocator(MEMORY_ALLOCATOR_BLOCK_SIZE) breaks the data in Octree< Real > tree; (which is initialized few lines of code before).

This can be resolved by setting MEMORY_ALLOCATOR_BLOCK_SIZE to 0 (in which case, we are not using the Allocator class).

What consequences are there to not using the Allocator class?

UPDATE:
It seems that the issue can also be resolved while continuing to use the Allocator class, by changing the set() method in Allocator.h to:

	void set( int blockSize )
	{
		if (this->blockSize != blockSize)
		{
			reset();
			this->blockSize = blockSize;
			index = -1;
			remains = 0;
		}
	}

@mkazhdan
Copy link
Owner

mkazhdan commented Oct 10, 2017 via email

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

3 participants