Page 1 of 6 12345 ... LastLast
Results 1 to 15 of 79
http://idgs.in/53427
  1. #1
    SrZ]Xevirath's Avatar
    Join Date
    Feb 2007
    Location
    Dragon Palace
    Posts
    3,427
    Points
    5,090.80
    Thanks: 0 / 20 / 16

    Post [Tutorial] Memory Leaks

    Tutorial:

    Memory Leaks



    I. Daftar Isi
    I. Daftar Isi
    II. Memory Leak
    III. Jenis Memory Leak
    IV. Cara Mengatasi
    V. Contoh LeakLess Trigger
    VI. Variables

    II. Memory Leak
    Apa itu Memory Leak?
    Memory Leak adalah sesuatu yang menambah memory yang digunakan oleh suatu program
    ketika kita meng"create" suatu objek. Seperti saat kita membuat Unit, dan lain lain.
    (...Kurang ngerti tentang komputer xD)
    Hal yang pasti adalah:
    1. Memory Leak menyebabkan Lag
    2. Memory Leak berlebih dapat menyebabkan Server Split
    3. Memory Leak berlebih menyebabkan random disconnect

    Wah... serem ya? Karena itu hindarilah Memory Leak...

    III. Jenis Memory Leak
    Seperti yang sudah dikatakan sebelumnya, Memory Leak muncul saat kita create
    suatu objek
    . Wah, apa saja tuh yang di"create"? Player? Unit? Unit Group?
    Nah... ini List untuk yang Leak dan Tidak Leak...

    NgeLeak:
    1. Special Effect
    2. Unit Group
    3. Player Group
    4. Point
    5. Region
    6. Floating Text
    7. Countdown Timer
    8. Timer Dialog
    9. Widgets (Mencakup: Unit, Item, dan Destructables)

    Masih ada sih, tapi itu yang paling sering keluar

    Tidak ngeLeak:
    1. Player
    2. Integer
    3. Real
    4. String

    Ya... semacem string sih leak, tapi mau diapain :confuse:
    Masih ada sih, tapi itu yang paling sering ditanya

    IV. Cara Mengatasi
    Cara untuk mengatasi Leak adalah dengan menghancurkan objek tsb setelah kita create DAN SEBELUM KITA OVERWRITE ATAU GANTI

    Nah... di sini kita ulang lagi bagian apa saja yang leak.
    Pertama,
    1. Special Effect
    Bagaimana cara menanggulangi Leak yang disebabkan oleh Special Effect?
    Pada suatu trigger GUI, biasanya kita melakukan ini...
    Code:
    Special Effect Leak
        Events
        Conditions
        Actions
            Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
    Nah, ini ngeLeak!
    Untuk menghilangkan leaknya, kita hancurkan Special Effect tsb

    begini cara menghancurkannya:
    Code:
    Special Effect No Leak
        Events
        Conditions
        Actions
            Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
            Special Effect - Destroy (Last created special effect)
    Tapi...
    Itu Special Effectnya langsung hilang... jadi cuma play Death Animation atau main animasinya 1x :tense:
    Jadi gimana buat yang tahan lama?
    Code:
    Special Effect No Leak
        Events
        Conditions
        Actions
            Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
            Set tempEffect = (Last created special effect)
            Wait 5.00 seconds
            Special Effect - Destroy tempEffect
    dimana tempEffect adalah Variable Special Effect...
    Ini tahan 5 detik
    Tapi...
    Ada masalahnya juga!
    Variablenya ga bisa dipake sama special effect lain kalo gini
    Nah ini tapi masalahnya sama Local Variables...
    bukan sama Leak

    Jadi lanjut ke yang kedua...
    2. Unit Group
    Kalau tidak salah kita sering bikin ini kan?
    Code:
    Unit Group Leak
        Events
        Conditions
        Actions
            Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
                Loop - Actions
    Nah, ini ngeLeak
    Pertama-tama, kita buat jadi Variables duLu... karena kita harus store data Unit Groupnya agar bisa kita destroy sewaktu-waktu
    Jadi begini...
    Code:
    Unit Group Leak
        Events
        Conditions
        Actions
            Set tempGroup = (Units in (Playable map area))
            Unit Group - Pick every unit in tempGroup and do (Actions)
                Loop - Actions
    Variablenya adalah tempGroup...
    Kan udah dijadiin Variable tuh ya...
    Sekarang, gimana untuk menghilangkan Leaknya?
    Kita harus menghancurkan Unit Group tersebut setelah selesai dipakai
    Tapi gimana ngancurinnya? Ga ada pilihannya buat ngancurin Unit Group...

    Di sini kita akan menggunakan Custom Script!
    Kita akan mengambil sebagian function dari JASS...
    Apa itu JASS? Sesuatu yang pasti sumber bahasa program dari GUI...
    Tapi kita di sini bukan untuk JASS, melainkan Memory Leak, jadi... lanjuuut

    Kita harus menambahkan Custom Script yang ditulis function JASS DestroyGroup...
    Hasilnya akan seperti ini:
    Code:
    Unit Group No Leak
        Events
        Conditions
        Actions
            Set tempGroup = (Units in (Playable map area))
            Unit Group - Pick every unit in tempGroup and do (Actions)
                Loop - Actions
            Custom script:   call DestroyGroup(udg_tempGroup)
    Apaan tuhhhh ? @#*@*# ga ngerti
    Saat kita menambah Custom Script... kita bisa menulis sesuatu di situ...
    tuLislah "call DestroyGroup(udg_VARIABLEUNITGROUP)"
    dan ingatlah kalau ini CASE SENSITIVE
    Oh... tapi udg_ apaan?
    udg = User Defined Global, pasti ada untuk semua Global Variable...
    Jadi gitu saja kira-kira...

    Unit Group sudah tidak ngeLeak!

    Panjang ya? Tapi itu baru yang kedua...

    3. Player Group
    Ya... ga beda jauh sama Unit Group
    Jadi kaLau sudah ngerti Unit Group, yang ini ga bakal susah...

    Dimulai dari yang masih ngeLeak,
    Code:
    Player Group Leak
        Events
        Conditions
        Actions
            Player Group - Pick every player in (All players controlled by a Computer player) and do (Actions)
                Loop - Actions
    Nah itu ngeLeak...
    Pertama set jadi Variable duLu...
    Code:
    Player Group Leak
        Events
        Conditions
        Actions
            Set tempForce = (All players controlled by a Computer player)
            Player Group - Pick every player in tempForce and do (Actions)
                Loop - Actions
    tempForce adalah variable Player Group...
    Nah... di sini kita kasih Custom Script lagi...
    Kita harus menambahkan Custom Script yang ditulis function JASS DestroyForce...
    Begini jadinya ...
    Code:
    Player Group No Leak
        Events
        Conditions
        Actions
            Set tempForce = (All players controlled by a Computer player)
            Player Group - Pick every player in tempForce and do (Actions)
                Loop - Actions
            Custom script:   call DestroyForce(udg_tempForce)
    Dah ga ngeLeak kan

    Pendek kan
    sekarang, yang ke-empat...

    4. Point
    Ini juga sering ada kan:
    Code:
    Point Leak
        Events
        Conditions
        Actions
            Unit - Move (Triggering unit) instantly to (Center of (Playable map area))
    Seperti biasa, ubah jadi variable duLu...
    Code:
    Point Leak
        Events
        Conditions
        Actions
            Set tempPoint = (Center of (Playable map area))
            Unit - Move (Triggering unit) instantly to tempPoint
    tempPoint adalah variable point...
    Nah, kali ini kita pakai Custom Script juga...
    functionnya kali ini adalah: RemoveLocation
    Code:
    Point No Leak
        Events
        Conditions
        Actions
            Set tempPoint = (Center of (Playable map area))
            Unit - Move (Triggering unit) instantly to tempPoint
            Custom script:   call RemoveLocation(udg_tempPoint)
    Ini juga sudah tidak ngeLeak
    Simple kan?

    Tapi jangan lengah...
    Masih ada lanjutannya...
    Pernah lihat ini?
    Code:
    Point Leak
        Events
        Conditions
        Actions
            Set tempPoint = ((Center of (Playable map area)) offset by 256.00 towards 0.00 degrees)
            Unit - Move (Triggering unit) instantly to tempPoint
            Custom script:   call RemoveLocation(udg_tempPoint)
    Ini NgeLeak, karena kita make Center of Playable map area...
    Artinya kita harus destroy ini juga....
    Gimana? Gini nih....
    Code:
    Point No Leak
        Events
        Conditions
        Actions
            Set tempPoint2 = (Center of (Playable map area))
            Set tempPoint = (tempPoint2 offset by 256.00 towards 0.00 degrees)
            Unit - Move (Triggering unit) instantly to tempPoint
            Custom script:   call RemoveLocation(udg_tempPoint2)
            Custom script:   call RemoveLocation(udg_tempPoint)
    Nah begitu

    Lanjut ke yang ke-lima...

    5. Region
    Untuk yang kali ini...
    Akan dipadukan beberapa bagian yang lain...
    Begini contoh yang ngeLeaknya:
    Code:
    Region Leak
        Events
        Conditions
        Actions
            Set tempPoint = (Position of (Triggering unit))
            Set tempGroup = (Units in (Region centered at tempPoint with size (500.00, 500.00)))
            Unit Group - Pick every unit in tempGroup and do (Actions)
                Loop - Actions
            Custom script:   call RemoveLocation(udg_tempPoint)
            Custom script:   call DestroyGroup(udg_tempGroup)
    Nah di situ ada leak Region...
    saat tempGroup sedang di set...
    kita membuat sesuatu tapi tidak ingat untuk menghancurkannya...
    untuk menghancurkannya... harus jadi variable duLu...
    Code:
    Region Leak
        Events
        Conditions
        Actions
            Set tempPoint = (Position of (Triggering unit))
            Set tempRegion = (Region centered at tempPoint with size (500.00, 500.00))
            Set tempGroup = (Units in tempRegion)
            Unit Group - Pick every unit in tempGroup and do (Actions)
                Loop - Actions
            Custom script:   call RemoveLocation(udg_tempPoint)
            Custom script:   call DestroyGroup(udg_tempGroup)
    Di sini juga Custom Script
    functionnya: RemoveRect
    Code:
    Region No Leak
        Events
        Conditions
        Actions
            Set tempPoint = (Position of (Triggering unit))
            Set tempRegion = (Region centered at tempPoint with size (500.00, 500.00))
            Set tempGroup = (Units in tempRegion)
            Unit Group - Pick every unit in tempGroup and do (Actions)
                Loop - Actions
            Custom script:   call RemoveLocation(udg_tempPoint)
            Custom script:   call RemoveRect(udg_tempRegion)
            Custom script:   call DestroyGroup(udg_tempGroup)
    6. Floating Text
    Aa...
    Untuk Floating Text, Countdown Timer, dan Timer Dialog...
    Kayaknya gampang kan udah ada pilihannya di GUI
    jadi kelihatannya ga perlu dijelasin...
    setelah dipakai, tinggal diDestroy...

    9. Widgets
    Untuk Unit, Item, dan Destructables...
    Cara menghilangkan Leaknya adalah dengan meRemovenya... bukan kill...
    Tapi biasanya kita ga akan ngeRemove kan
    karena biasanya kita butuh sampai game seLesai...

    V. Contoh LeakLess Trigger
    Code:
    Good LeakLess Trigger
        Events
            Unit - A unit Is attacked
        Conditions
            (Triggering unit) Equal to UnitYangSangatIMBA
        Actions
            Set tempUnit = (Attacking unit)
            Wait 5.00 seconds
            Set tempPoint = (Position of tempUnit)
            Set tempRegion = (Region centered at tempPoint with size (256.00, 256.00))
            Set tempGroup = (Units in tempRegion)
            Unit Group - Pick every unit in tempGroup and do (Actions)
                Loop - Actions
                    Unit - Kill (Picked unit)
            Custom script:   call RemoveRect(udg_tempRegion)
            Custom script:   call DestroyGroup(udg_tempGroup)
            Set tempRegion = (Region centered at tempPoint with size (96.00, 96.00))
            Set tempGroup = (Units in tempRegion)
            Unit Group - Pick every unit in tempGroup and do (Actions)
                Loop - Actions
                    Unit - Remove (Picked unit) from the game
            Custom script:   call RemoveLocation(udg_tempPoint)
            Custom script:   call RemoveRect(udg_tempRegion)
            Custom script:   call DestroyGroup(udg_tempGroup)
    VI. Variables
    Variable tidak menghilangkan Leak atau apapun.
    Variable hanya membantu kita untuk memberi nama pada suatu objek,
    dimana jika sembarang ngeCreate objek, kita tidak tahu namanya dan alhasil kita tidak bisa menghancurkannya
    Masih mungkin setelah kita create langsung dihancurkan, dan itu tidak menghasilkan Leak.
    Jadi, Variable hanya bersifat membantu, dan penghilangan leak ada pada hancurnya objek.

    Beberapa guna Variable:
    1. Mempercepat peng-eksekusian Action.
    Misal kita membutuhkan "Event Response - Attacking Unit" lebih dari satu kali,
    Alangkah baiknya jika diSet jadi Variable duLu...
    2. Data Storing
    Kita bita menyimpan unit "Event Response - Attacking Unit", mengingat jika kita gunakan Action Wait atau sejenisnya,
    "Event Response - Attacking Unit" sudah tidak berlaku.
    Jadi di awal trigger sebelum ada wait dan sejenisnya kita set jadi Variable dan setelah wait kita bisa gunakan Variable tsb
    menggantikan "Event Response - Attacking Unit"

    Hanya sekilas info tentang Variable

    ***END OF TUTORIAL***
    Thx for ur time spent with this Tutorial
    Mungkin masih banyak kekurangan, tapi ntar bakal diupdate deh
    Gw masih agak nubi
    Pertanyaan reply di bawah aja

    Last edited by SrZ]Xevirath; 23-05-09 at 14:14.

  2. Hot Ad
  3. #2
    DoOs_101's Avatar
    Join Date
    Oct 2006
    Location
    Jakarta
    Posts
    2,371
    Points
    3,181.21
    Thanks: 0 / 9 / 8

    Default

    Congragulations!

    ++rep
    Quotes of the week:
    "He vanishes only to return as a tyrant."


  4. #3
    l0git3c's Avatar
    Join Date
    Oct 2006
    Location
    England, Manchester
    Posts
    3,968
    Points
    4,650.70
    Thanks: 0 / 3 / 3

    Default

    niceee!! jadi tambah pengetahuan

  5. #4
    chrnos's Avatar
    Join Date
    Jun 2007
    Location
    Reality Marble
    Posts
    1,768
    Points
    650.85
    Thanks: 39 / 17 / 17

    Default

    OMG! Baru tau gw . .berarti leak semua dong gw -_-! . .kaga make custom script

  6. #5
    BuaYa JingkRaK's Avatar
    Join Date
    Oct 2007
    Location
    When u believe me then I'll be there
    Posts
    613
    Points
    711.00
    Thanks: 0 / 0 / 0

    Default

    sep !
    ini baru si than2 keren...::hahaha::

  7. #6
    Section's Avatar
    Join Date
    Nov 2006
    Location
    about.me/SECTION
    Posts
    2,095
    Points
    11,041.04
    Thanks: 45 / 112 / 98

    Default

    Wah2 gile.... Untung ada forum!
    Sumpah! Ini berguna banget! But a But! Semua tutorial anda sudah di pack oleh seseorang di luar negeri dengan programnya bernama "Leak Check". Dengan versi terbarunya, semua hal yang anda tulis sudah teratasi. Tapi thread ini sangat bagus kok! Jadi kayaknya aku mesti cek ulang project aku ini.

    HELP!!! Mumpung berhubungan dengan leak... Map aku ( ini yang tertulis di signnature ) sudah cukup anti leak. Tapi sayangnya setiap aku mengeluarkan skill yang tipenya ke seluruh penjuru ( kayak Poison Novanya Lesale di DotA atau ngeluarin Shockwave ke setiap 15 derajat ) pasti jadi lag berat dan diagnosaku ini pasti leak. Ada yang tahu?

    Tolong siapa yang bisa saya percaya... cek map aku... Aku kasi ke E-mail kalian.
    Makasi...

    (ini map adalah proyek yang tertunda selama 4 tahun, saat pertama belajar WE dengan trigger).

  8. #7
    imoRomi's Avatar
    Join Date
    Oct 2007
    Location
    In Bandung the Maksiat City
    Posts
    191
    Points
    216.50
    Thanks: 0 / 0 / 0

    Default

    Mapnya si lambhe tuh... Twinklecraft... pasti banyak memory leaknya.. pusing sekali awak maininnya..

  9. #8
    phonoscope's Avatar
    Join Date
    Nov 2007
    Location
    On Pad™
    Posts
    2,521
    Points
    2,951.70
    Thanks: 0 / 0 / 0

    Default

    metaaaaaal dah info nya..... [walau gw ga ngerti ^^]

  10. #9
    valkemiere's Avatar
    Join Date
    Oct 2006
    Location
    In my Rainbow Castle
    Posts
    1,874
    Points
    5,111.21
    Thanks: 65 / 32 / 31

    Default

    nah selain itu every 0.03 detik itu bisa bkin ngeleak jg ,
    klo singel player ga masalah, klo multiplayer ngeleak.

  11. #10
    MimiHitam's Avatar
    Join Date
    Oct 2006
    Posts
    9,242
    Points
    16,524.95
    Thanks: 14 / 58 / 42

  12. #11
    l0git3c's Avatar
    Join Date
    Oct 2006
    Location
    England, Manchester
    Posts
    3,968
    Points
    4,650.70
    Thanks: 0 / 3 / 3

    Default

    Quote Originally Posted by valkemiere View Post
    nah selain itu every 0.03 detik itu bisa bkin ngeleak jg ,
    klo singel player ga masalah, klo multiplayer ngeleak.
    nahhhhh, yg kek gini gw gak tau cara ilanginnya,,,,

    ada yg tao caranya ga?


    @mimi
    dah, lanjutinnya di sini aja :nosweat:

  13. #12
    DoOs_101's Avatar
    Join Date
    Oct 2006
    Location
    Jakarta
    Posts
    2,371
    Points
    3,181.21
    Thanks: 0 / 9 / 8

    Default

    Quote Originally Posted by MimiHitam View Post
    Thread ini dia bikin sebagai Tutorial dan mengikuti format tutorial yang disarankan oleh rules :dance4: - kalo thread kamu dijadiin thread buat discuss atau lapor masalah tentang leaks aja.
    Quotes of the week:
    "He vanishes only to return as a tyrant."


  14. #13
    MimiHitam's Avatar
    Join Date
    Oct 2006
    Posts
    9,242
    Points
    16,524.95
    Thanks: 14 / 58 / 42

    Default

    mending dimerge ~_~ ga enak kalo ada double thread

  15. #14
    SrZ]Xevirath's Avatar
    Join Date
    Feb 2007
    Location
    Dragon Palace
    Posts
    3,427
    Points
    5,090.80
    Thanks: 0 / 20 / 16

    Default

    Quote Originally Posted by Section View Post
    Wah2 gile.... Untung ada forum!
    Sumpah! Ini berguna banget! But a But! Semua tutorial anda sudah di pack oleh seseorang di luar negeri dengan programnya bernama "Leak Check". Dengan versi terbarunya, semua hal yang anda tulis sudah teratasi. Tapi thread ini sangat bagus kok! Jadi kayaknya aku mesti cek ulang project aku ini.

    HELP!!! Mumpung berhubungan dengan leak... Map aku ( ini yang tertulis di signnature ) sudah cukup anti leak. Tapi sayangnya setiap aku mengeluarkan skill yang tipenya ke seluruh penjuru ( kayak Poison Novanya Lesale di DotA atau ngeluarin Shockwave ke setiap 15 derajat ) pasti jadi lag berat dan diagnosaku ini pasti leak. Ada yang tahu?

    Tolong siapa yang bisa saya percaya... cek map aku... Aku kasi ke E-mail kalian.
    Makasi...

    (ini map adalah proyek yang tertunda selama 4 tahun, saat pertama belajar WE dengan trigger).
    Leak Checker ngeBug :dizzy: yang terakhir gw pake sih,
    nTar gw coba cek... kaLau ada waktu

  16. #15
    l0git3c's Avatar
    Join Date
    Oct 2006
    Location
    England, Manchester
    Posts
    3,968
    Points
    4,650.70
    Thanks: 0 / 3 / 3

    Default

    gw pake leak check versi terbaru...

    pas make trigger picked every unit, ttp dibilang leak kalo kek gini

    Unit Group No Leak
    Events
    Conditions
    Actions
    Set tempGroup = (Units in (Playable map area))
    Unit Group - Pick every unit in tempGroup and do (Actions)
    Loop - Actions
    Custom script: call DestroyGroup(udg_tempGroup)
    ~_~

Page 1 of 6 12345 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •