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

Add memory init/shutdown in android libs #3397

Merged
merged 1 commit into from
Oct 22, 2020

Conversation

andy31415
Copy link
Contributor

Problem

Android crashes on platform allocs because init was never called.

Summary of Changes

add init/shutdown on jvm load/unload for chipcontroller.

NOTE: we assume controller is always added, although technically one could add just the setupparser and things would still crash. For our current purposes though, this seems enough.

@bzbarsky-apple
Copy link
Contributor

although technically one could add just the setupparser and things would still crash

This is a general problem; iOS CHIPTool is running into this too. I filed #3398 to sort it out.

@vidhis88
Copy link
Contributor

Does #3399 override this change?

@mspang mspang merged commit 29d1862 into project-chip:master Oct 22, 2020
mspang added a commit to mspang/connectedhomeip that referenced this pull request Oct 22, 2020
This needs a re-think; there are several problems currently:

- refcounting of objects with static storage duration
- refcounting of objects with automatic storage duration (stack objects)
- refcounting of subobjects
  - including multiple base class subobjects (diamond inheritance)

The majority of current uses are in contexts where lifetime could not be
extended by reference counting and in general, the initial reference is
not dropped. The remaining case looks like a case of unique ownership.

If delegate interfaces really need to be refcounted, we'll need to ban
multiple inheritance of them (without resorting to virtual inheritance).

Reland with some #include needed after project-chip#3397.

fixes project-chip#3348
BroderickCarlin pushed a commit that referenced this pull request Oct 26, 2020
* Remove refcounting (reland of #3356)

This needs a re-think; there are several problems currently:

- refcounting of objects with static storage duration
- refcounting of objects with automatic storage duration (stack objects)
- refcounting of subobjects
  - including multiple base class subobjects (diamond inheritance)

The majority of current uses are in contexts where lifetime could not be
extended by reference counting and in general, the initial reference is
not dropped. The remaining case looks like a case of unique ownership.

If delegate interfaces really need to be refcounted, we'll need to ban
multiple inheritance of them (without resorting to virtual inheritance).

Reland with some #include needed after #3397.

fixes #3348

* Add missing #include <CHIPMem.h>

* Add more missing includes
@andy31415 andy31415 deleted the 01_fix_mem_init_in_android branch October 28, 2020 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants