• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Page Information

    Loading...
  1. Dashboard
  2. Undefined Space
  3. Port: MacOSX
  4. ObjC Memory Management & Java

Page History

Versions Compared

Old Version 3

changes.mady.by.user Mike Swingler

Saved on Jun 09, 2011

compared with

New Version 4

changes.mady.by.user Mike Swingler

Saved on Jun 09, 2011

  • Previous Change: Difference between versions 2 and 3
  • Next Change: Difference between versions 4 and 5
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • ObjC objects that are +alloc'd or -retained are not actually pinned in GC-mode unless they have been CFRetain()'d
    • As a counterpoint, any CFRetain()'d ObjC object must be -released or -autoreleased for it's retain count to remain balanced in RR mode
  • The ObjC garbage collector cannot see into the Java heap, and infer if any native objects are still "alive"

Don't manage JNI global refs yourself

  • If you need to pass a Java object through native (like to the main AppKit thread, or inside of an NSArray), use JNFJObjectWrapper or JNFJObjectWeakWrapper
    • It handles all the details of managing a JNI global ref in a native ObjC object in both RR and GC modes
  • If you have a JNIEnv when you are done with the JNFJObjectWrapper, pre-clear the reference
    • It is more efficient than the wrapper's -dealloc, which may have to connect the current thread to the JVM (possibly a ObjC-GC collector thread), just for the purposes of deleting the ref.
Overview
Content Tools
ThemeBuilder

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.21
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 315, "requestCorrelationId": "7cf354d716a4ede4"}