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

Fix another new[]/delete mismatch. #21

Merged
merged 1 commit into from Sep 7, 2016

Conversation

smuehlst
Copy link
Contributor

@smuehlst smuehlst commented Sep 6, 2016

During my experiments with circle I found another new[]/delete mismatch in the CLogger class.

BTW, wouldn't it make sense to replace the allocated CLogger::m_pBuffer pointer with a
member array of size LOGGER_BUFSIZE, as the size is known at compile time anyway?
This would avoid the new/delete for CLogger::m_pBuffer altogether.

@rsta2 rsta2 merged commit 4354aa2 into rsta2:master Sep 7, 2016
@rsta2
Copy link
Owner

rsta2 commented Sep 7, 2016

Thanks for this pull request. I have merged it.

I think it's better to allocate such buffers on the heap which is much bigger than the kernel stack (only 128 KB) where the CLogger object is normally created. Because this object is constructed only once, while the system is initialized, there would be no performance gain.

@smuehlst
Copy link
Contributor Author

smuehlst commented Sep 7, 2016

@rsta2 : I see, I wasn't aware of the limitation of the kernel stack. Can the size of the kernel stack be configured somehow?

@rsta2
Copy link
Owner

rsta2 commented Sep 8, 2016

Have a look at include/circle/sysconfig.h. The memory layout of the data regions behind the loaded kernel image is defined there.

You can increase the KERNEL_STACK_SIZE there. But be sure that it is a multiple of 16KB (so that MEM_PAGE_TABLE1 stays 16KB aligned) and that you don't run into MEM_HEAP_START and MEM_COHERENT_REGION (on RPi 3 only, must be on a 1MB boundary) which are set to a fixed address. Please note that on the RPi 2 and 3 there are four separate kernel stacks (one for each CPU core) of the defined size.

The following changes set the kernel stack size to 1MB:

#define KERNEL_STACK_SIZE   0x100000
...
#if RASPPI == 3
#define MEM_COHERENT_REGION 0x1000000
#define MEM_HEAP_START      0x1100000
#else
#define MEM_HEAP_START      0x1000000
#endif

@smuehlst smuehlst deleted the fix_clang_warnings branch April 28, 2017 20:15
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

Successfully merging this pull request may close these issues.

None yet

2 participants