Skip to content

Commit

Permalink
Documentation cleanup (#371)
Browse files Browse the repository at this point in the history
* Update README.md

* Update GC.md

General cleanup

* Update README.md

* Update README

* Update README

* Update README.md

* Update README.md
  • Loading branch information
ternera authored Oct 25, 2024
1 parent 23433a8 commit 9ecd6c8
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions MacOS/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
This folder is used to package huggle for MacOS
This folder is used to package Huggle for MacOS.

Requirements:
* xcode
* git

just run release.sh and dmg file will be produced
Run `release.sh` and the `.dmg` file will be produced.
16 changes: 8 additions & 8 deletions documentation/GC.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Garbage collector
===================

This document describes the garbage collector used by huggle and how it works.
This document describes the garbage collector used by Huggle and how it works.

Preamble
==========
Expand All @@ -13,22 +13,22 @@ What is it

Garbage collector is specifically designed for lazy developers, who don't want to keep track of resources. It allows for collection (removal of resources) from operating memory. The point of GC is that it can collect the resources which are no longer needed for anything, without requiring developers to explicitly delete them.

GC in Huggle is implemented as a background job that is started by huggle core, which checks all managed objects and remove these, which aren't needed anymore, from operating memory.
GC in Huggle is implemented as a background job that is started by Huggle core, which checks all managed objects and removes unneeded ones from operating memory.

Why we need it
================

Because we are lazy as many other devs. This thing makes our work easier.
Because many developers are lazy and this thing makes our work easier.

How does it work
==================

Huggle uses its own GC which is very transparent and adaptive, so it can be used as a drop in replacement for any other memory management. The garbage collector does only a collection of managed collectable objects. Every object that inherits class Huggle::Collectable is collectable. However, object which is collectable doesn't necessarily need to be removed by garbage collector unless it is managed. You must never call delete on any managed object, since that will raise an exception. Not all objects in huggle (in fact most of them) are collectables or managed. That means you should use delete keyword for most of objects you work with, unless they are collectable. You always need to verify this, it's really important, but keep in mind, that devs are using GC only for objects where memory management is really complicated. Typical example of managed object is a query. These objects contain lot of dependecies and it's hard to determine whether they can be delete from memory or not, so that's why we are using garbage collector.
Huggle uses its own GC which is very transparent and adaptive, so it can be used as a drop in replacement for any other memory management. The garbage collector does only a collection of managed collectable objects. Every object that inherits class `Huggle::Collectable is collectable`. However, object which is collectable doesn't necessarily need to be removed by garbage collector unless it is managed. You must never call delete on any managed object, since that will raise an exception. Not all objects in Huggle (in fact most of them) are collectables or managed. That means you should use a delete keyword for most of objects you work with, unless they are collectable. You always need to verify this. It's really important, but keep in mind that devs are using GC only for objects where memory management is complicated. An example of a managed object is a query. These objects contain lot of dependecies and it's difficult to determine whether they can be deleted from memory or not, so that's why we are using garbage collector.

Collectable object
====================

By collectable object we mean an object that can be collected by GC. In huggle all these objects are derived from Collectable class.
When we use the term, "collectable object", we mean an object that can be collected by GC. In Huggle, all of these objects are derived from the Collectable class.

Managed object
================
Expand All @@ -38,16 +38,16 @@ Managed collectable is object that MUST be collected by GC. Deletion of managed
Smart pointers
================

Modern implementation of GC supports smart pointers, which are preferred and easiest way of using GC. Main disadvantage of smart pointers is that it's not easily possible to track down why some resource isn't being freed, so they are worse from debugging point of view. Other than that they are much easier to use than traditional consumer model.
Modern implementation of GC supports smart pointers, which are the preferred and easiest way of using GC. The main disadvantage of smart pointers is that it's not easily possible to track down why some resources aren't being freed, so they are worse from a debugging point of view. Other than that, they are much easier to use than the traditional consumer model.

Consumers
============

Consumers are virtual elements that are using the collectable object. For example if you hold a reference to an object within some function, this function is a consumer of that object. The same applies for classes or fundamental pointers. Every consumer needs to be registered in collectable object so that GC knows it is still being used by it. When you no longer need to use some resource within a consumer, you need to remove it from collectable object.
Consumers are virtual elements that are using the collectable object. For example if you hold a reference to an object within some function, that function is a consumer of the object. The same applies for classes or fundamental pointers. Every consumer needs to be registered in collectable object so that GC knows it is still being used by it. When you no longer need to use some resource within a consumer, you need to remove it from collectable object.

In simple words, the consumers are locks that prevent GC from removing an object from memory.

How to create and collect managed object
=========================================

Every collectable object can be set to managed by registering at least one consumer. You can do that by calling Huggle::Collectable::RegisterConsumer(QString) or Huggle::Collectable::RegisterConsumer(int). Once at least 1 consumer is registered, the object is managed. If all consumers of managed object are removed, the object is collected.
Every collectable object can be set to managed by registering at least one consumer. You can do that by calling `Huggle::Collectable::RegisterConsumer(QString)` or `Huggle::Collectable::RegisterConsumer(int)`. Once at least one consumer is registered, the object is managed. If all consumers of managed object are removed, the object is collected.
11 changes: 4 additions & 7 deletions documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ Huggle documentation
====================

Huggle 3 is an antivandalism software for use on Wikipedia and other Wikimedia projects.
It is written in C++ (QT framework).
Huggle can be used on Windows, Linux, Ubuntu, MacOS, etc.
It is written in C++ (QT framework). Huggle can be used on Windows, Linux and MacOS.

Please read [README.md](https://github.com/huggle/huggle3-qt-lx/blob/master/README.md) to find out more general information.

Please read [README.md](https://github.com/huggle/huggle3-qt-lx/blob/master/README.md)
to find out more general information.

Regular users shouldn't use this documentation. Instead read:
[Meta] (https://meta.wikimedia.org/wiki/Huggle).
Regular users shouldn't use this documentation. Instead read the documentation at
[here](https://meta.wikimedia.org/wiki/Huggle).
4 changes: 2 additions & 2 deletions snap/README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
http://snapcraft.io/

This script currently works only with Ubuntu 16.04 you are welcome to adapt it to other distros as well.
This script currently works only with Ubuntu 16.04. You are welcome to adapt it to other distros as well.

To package huggle, go to root folder and type "snapcraft"
To package Huggle, go to your `root` folder and type "snapcraft".
7 changes: 3 additions & 4 deletions src/huggle/README
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
This is Huggle launcher
This is the Huggle launcher.

On Windows this builds "huggle.exe"
On Linux this makes binary huggle
On Windows, this builds "huggle.exe". On Linux, this makes the binary "huggle".

It's just an entry point for the core_lib and ui_lib
It's just an entry point for the `core_lib` and `ui_lib`.
14 changes: 8 additions & 6 deletions windows/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
Windows
=========

This is used to build packages for windows, how-to:
This is used to build packages for Windows systems.

* Open Huggle.nsi and update the version of huggle to current one
* Run powershell script release.ps1
* You can pick generator using -cmake_generator
# Instructions:

By default this script will try to use Visual Studio to compile huggle, you may want to pass parameter -mingw true
* Open `Huggle.nsi` and update the version of Huggle to current one
* Run powershell script `release.ps1`
* You can pick generator using `-cmake_generator`

We use MingW for 32bit version of huggle for release builds because it has fewer dependencies than Visual Studio and works on more versions of Windows with no need to install any redistributable files from MS
By default, this script will try to use Visual Studio to compile Huggle. You may want to pass the parameter `-mingw true`.

We use MingW for the 32bit version of Huggle release builds because it has fewer dependencies than Visual Studio and works on more versions of Windows with no need to install any redistributable files from Microsoft.
14 changes: 8 additions & 6 deletions windows64/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
Windows
=========

This is used to build x64 huggle for windows, how-to:
This is used to build the x64 version Huggle for Windows.

# Instructions:

* Download http://nsis.sourceforge.net/Download
* Install

Now it's a little bit tricky, you will need to do this:
It can be tricky, you will need to do this:

* Download VS 2013 redistributables and save them in this folder as vcredist_x64_2013.exe - this is necessary for OpenSSL to work
* Download VS 2015 or 2017 (depends what you are using to build Huggle) redistributables and save them in this folder as vcredist_x64.exe
* Download VS 2013 redistributables and save them in this folder as `vcredist_x64_2013.exe` - this is necessary for OpenSSL to work
* Download VS 2015 or 2017 (depends what you are using to build Huggle) redistributables and save them in this folder as `vcredist_x64.exe`
* Download OpenSSL libraries for slproweb, 1.0.2x branch
* Open pack.ps1 and update all variables, provide path to your VS, Qt and OpenSSL
* Open `pack.ps1` and update all of the variables, provide path to your VS, Qt and OpenSSL
* Install git and cmake (so that it works in PowerShell)
* Execute PowerShell pack.ps1
* Execute PowerShell `pack.ps1`

0 comments on commit 9ecd6c8

Please sign in to comment.