How Blink Work [번역]

Memory management

Memory management

블링크에 관한한, 다음의 세가지 메모리 관리자에 대하여 주의해야 합니다:

 

 

USING_FAST_MALLOC()을 사용하여 PartitionAlloc의 힙메모리에 객체를 생성할 수 있습니다:

 

class SomeObject {

  USING_FAST_MALLOC(SomeObject);

  static std::unique_ptr<SomeObject> Create() {

    return std::make_unique<SomeObject>();  // Allocated on PartitionAlloc's heap.

  }

};

 

PartitionAlloc에 의해 생성된 객체의 생애주기는 scoped_refptr<> 또는 std::unique_ptr<>로 관리되어야 합니다.

 

GarbageCollected를 이용하여 Oilpan의 힙에 객체를 생성할 수도 있습니다:

 

class SomeObject : public GarbageCollected<SomeObject> {

 static SomeObject* Create() {

    return new SomeObject;  // Allocated on Oilpan's heap.

  }

};

 

Oilpan에 의해 생성된 객체의 생애주기는 가비지콜렉션(GC)에 의해 자동으로 관리됩니다. Oilpan의 힙에 있는 객체를 가리키기 위해서는 특별한 포인터(예, Member<>, Persistent<>)를 사용해야 합니다. 여기서 가장 중요한 제약사항은 Oilpan 객체의 소멸자(destructor)에서는 다른 Oilpan 객체에 접근할 수 없다는 것입니다(왜냐하면 객체들의 소멸 순서가 명확하지 않기 때문입니다).

 

USING_FAST_MALLOC()도 GarbageCollected도 사용하지 않는다면, 객체는 시스템 malloc 힙에 생성됩니다. 블링크에서는 이렇게 사용하지 말것을 강력히 권고합니다.

 

  • Oilpan을 기본으로 사용합니다.
  • PartitionAlloc은 다음의 경우에만 사용합니다. 1) 객체의 생애주기가 아주 명확하고 std:unique_ptr<>로도 충분할 경우, 2) Oilpan에 객체를 할당하면 많은 복잡성이 발생하는 경우, 3) Oilpan에 객체를 할당하게되면 런타임에 불필요한 GC가 많이 일어나는 경우.

 

PartitionAlloc와 Oilpan 중 어떤 것을 사용하건, 매달린 포인터(Dangling Pointer - 이미 해제된 메모리 영역을 가리키고 있는 포인터)가 생성되거나 메모리 누수가 발생하지 않도록 정말 주의해야 합니다.(참고: 원시포인터는 강력히 비추천)

 

If you want to learn more:

 

 

댓글

댓글 본문
작성자
비밀번호
  1. wwwe
    http://www.yesyeezy.shop......tml
    http://www.monclerjackets.us
    http://www.filas.us.com
    http://www.coachoutletsfactory.com
    http://www.offwhitehoodie.us.com
    http://www.paulgeorgeshoes.us.com
    http://www.katespadehandbags-outlet.us.com
    http://www.supremehoodie.us.com
    http://www.yeezy700.us.com
    http://www.adidasstansmith.us.com
    http://www.goldengoose-outlet.us.com
    http://www.adidassuperstar.us.com
    http://www.yesyeezy.shop......tml
    http://www.yesyeezy.shop......tml
    http://www.yesyeezy.shop......tml
    http://www.michael-korsoutlets.us
    http://www.kobeshoes.uk
    http://www.adidasyeezys.us
    http://www.fitflops-saleclearance.us.com
    http://www.monclersoutlet.us.com
    http://www.nikeair-max.us.com
    http://www.yslhandbags.net
    http://www.adidaseqts.com
    http://www.adidasnmds.com
    http://www.nikejordans.us.com
    http://www.mbtshoesonline.com
    http://www.chromeheartsstore.us
    http://www.adidasyeezys.us.com
    http://www.nike-huarache.com
    http://www.kyrie3.us.com
    http://www.longchamphandbagsoutlets.com
    http://www.yesyeezy.shop......tml
    http://www.yeezy-shoes.us.org
    http://www.reebokoutlet.us.org
    http://www.coachoutlets.name
    http://www.airmax270.us.com
    http://www.kd11.us.com
    http://www.rolex-replica.us.com
    http://www.ferragamobelt.us.org
    http://www.yesyeezy.shop......tml
    http://www.russellwestbrookshoes.us.com
    http://www.hermesonlineshop.com
    http://www.yeezyboost-350v2.us.com
    http://www.nikeairforce1.us.com
    http://www.kobebasketballshoes.net
    http://www.curry4.us.com
    http://www.michaelkors-outletfactory.us.org
    http://www.goyard-handbags.us.com
    http://www.hermesbelts.co.uk
    http://www.bapehoodie.us
    http://www.outletmichael-kors.us.com
    http://www.nikepolo.us
    http://www.guccibelt.us.com
    http://www.jordan4.us.com
    http://www.nikehuaracheshoes.us.com
    http://www.chromehearts.com.co
    http://www.ferragamobelt.us
    http://www.michaelkors-outletstore.com
    http://www.jordan13.us.com
    http://www.jordansshoes.us.org
    http://www.adidasnmduk.com
    http://www.nikesneakers.us.com
    http://www.nike-hyperdunk.us.com
    http://www.curry4shoes.us.com
    http://www.nikecortez.us.com
    http://www.air-max.us.com
    http://www.coachoutletssale.com
    http://www.goldengoose-sneakers.com
    http://www.airmax90.us.org
    http://www.goyardhandbags.org
    http://www.goyardbags.us
    http://www.adidas-crazyexplosive.us.com
    http://www.yesyeezy.shop......tml
    http://www.adidaszxflux.com
    http://www.yeezy-500.us.com
    http://www.hermesbelts.com
    http://www.yesyeezy.shop......tml
    http://www.yeezysshoes.us.com
    http://www.michael--korsoutlet.us.org
    http://www.calvinkleinoutlet.us.com
    http://www.goldengoose-sneakers.us
    http://www.nikereact.org
    http://www.kevindurant-shoes.us.com
    http://www.yeezy-boost.us.com
    http://www.hermes-birkin.us.com
    http://www.jordan12.us.com
    http://www.kobesneakers.com
    http://www.nike-roshe.us.com
    http://www.yeezyboost.com.co
    http://www.curry5.us.com
    http://www.yeezy-shoes.org.uk
    http://www.vapormaxshoes.us
    http://www.nike-airmax2017.us.com
    http://www.longchamp-bags.us.org
    http://www.nikeflyknit.us.com
    http://www.adidasshoesonline.com
    http://www.kyrie4.org
    http://www.polosralphlaurenuk.com
    http://www.hermes-handbags.us.com
    http://www.outlettimberland.us.org
    http://www.adidasstansmith.uk
    http://www.caterpillarboots.us.com
    http://www.hoganoutletonline.us.com
    http://www.balenciagashoes.us.com
    http://www.shoesjordan.us.com
    http://www.redbottom-shoes.us.com
    http://www.outletonline-michaelkors.us.org
    http://www.off-whiteshoes.us.com
    http://www.lebronjames-shoes.us.com
    http://www.kobe-shoes.us.com
    http://www.monclerjacket.net
    http://www.vans-outlet.us.com
    http://www.yesyeezy.shop......tml
    http://www.yeezy-shoes.ca
    http://www.jimmychoo-shoes.us.com
    http://www.longchamphandbagsonlines.com
    http://www.lacostepolo.us.com
    http://www.jordan11retro.us.com
    http://www.yeezy-boost350.us.com
    http://www.jordan-retro.us.com
    http://www.adidasoutletonline.com
    http://www.canada--goose.co.uk
    http://www.kd11.us
    http://www.offwhitexjordan1.com
    http://www.asics-shoes.us.org
    http://www.yeezysuk.com
    http://www.mlbjerseys.in.net
    http://www.fakerolex.us.com
    http://www.goldengoose.us.com
    http://www.yeezyboost350v2.org.uk
    http://www.supremeclothing.us
    http://www.fila.us.org
    http://www.adidasiniki.us
    http://www.lebron16.net
    http://www.nike-shox.us.com
    http://www.retro-jordans.us.com
    http://www.yeezy-shoes.org
    http://www.goldengoosesneakers.us
    http://www.birkinbag.us.com
    http://www.lebron16.us
    http://www.filashoes.org
    http://www.outletlacoste.us.com
    http://www.yesyeezy.shop......tml
    http://www.michael-kors-handbags.org.uk
    http://www.yesyeezy.shop......tml
    http://www.chromehearts.name
    http://www.yeezyshoesuk.com
    http://www.adidasgazelle.us.com
    http://www.jordanssneakers.us.com
    http://www.nikeairmax2018.us.com
    http://www.toryburchs.us
    http://www.goyardhandbags.us.com
    http://www.fila-shoes.us.com
    http://www.yeezyboost.in.net
    http://www.nikeairmax2019.us.com
    http://www.nhljerseysshop.us.com
    http://www.adidasyeezy.co.uk
    http://www.cheapnbajerseyswholesales.us.com
    http://www.jordanshoes.org.uk
    http://www.goldengooseoutlet.us
    http://www.adidasultraboost.us.org
    http://www.lebron15.net
    http://www.yeezyboost350v2shoes.us.com
    http://www.lacostepolosshirts.com
    http://www.adidas-nmds.us.com
    http://www.balenciaga.us.com
    http://www.coachoutletstorefactory.com
    http://www.adidas-tubular.us.com
    http://www.lacosteonlineshop.us.com
    http://www.cheap-airjordans.us.com
    http://www.nikebasketballshoes.us.com
    http://www.lebron16.us.com
    http://www.kd-10.us
    http://www.jordansforcheap.us.com
    http://www.long-champ.us.com
    http://www.michael-kors-handbags.com.co
    http://www.golden-goose.us.com
    http://www.nikereact.us.com
    http://www.ultraboost.us.com
    http://www.hermeshandbags.us.org
    http://www.yeezy500.us
    http://www.offwhiteclothing.us.com
    http://www.offwhite.us.com
    http://www.michaelkorsoutletonlineus.com
    http://www.airjordanretro.uk
    http://www.linksoflondon.us.com
    http://www.jordan6.us.com
    http://www.hardenshoes.us.com
    http://www.hermes-belt.us.com
    http://www.goyard.us.com
    http://www.yeezy-boosts.us.com
    http://www.louboutinshoes.uk
    http://www.balenciagashoes.us.org
    http://www.michaelkors-outletonlines.us.com
    http://www.long-champhandbags.org.uk
    http://www.bape-hoodie.us.com
    http://www.yesyeezy.shop......tml
    http://www.converseoutlet.us.com
    http://www.nfljerseys.us.org
    http://www.coachsonline.us.com
    http://www.yesyeezy.shop......tml
    http://www.pandorabracelet.in.net
    http://www.valentinos.us.com
    http://www.yeezyboost-350.uk
    http://www.adidas-pureboost.us.com
    http://www.handbagsmichaelkors.com
    http://www.kyrieirving-shoes.us.com
    http://www.curry5.us
    http://www.michaeljordanshoes.us.com
    http://www.nikefoamposite.us.com
    http://www.yesyeezy.shop
    wwwe
버전 관리
지니
현재 버전
선택 버전
graphittie 자세히 보기