1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

doc: update memory management info

This commit is contained in:
Alexander Medvednikov 2023-05-22 08:36:31 +02:00
parent 1be798be49
commit 3a09142ace
2 changed files with 15 additions and 6 deletions

View File

@ -1,5 +1,6 @@
## V 0.3.5
*not yet released*
- A new VPM site: vpm.vlang.io. A better design, discoverability of packages, descriptions, most downloaded packages etc.
- Struct fields can now be skipped during JSON/ORM serialization via `[json:'-']` and `[sql:'-']`,
in addition to `[skip]`. This allows having custom behavior for different serialization methods.
- ORM: fixed a foreign key bug that could result in an extra insert.
@ -8,6 +9,7 @@
- json: Enum value string serialization supports `[json:'alias']` to change its string values.
- Functions can now return fixed size arrays.
- The builtin websocket library is now thread safe.
- Enhanced builtin csrf protection in vweb.
## V 0.3.4

View File

@ -4532,13 +4532,20 @@ fn test_subtest() {
V avoids doing unnecessary allocations in the first place by using value types,
string buffers, promoting a simple abstraction-free code style.
Most objects (~90-100%) are freed by V's autofree engine: the compiler inserts
necessary free calls automatically during compilation. Remaining small percentage
of objects is freed via reference counting.
There are 4 ways to manage memory in V.
The developer doesn't need to change anything in their code. "It just works", like in
Python, Go, or Java, except there's no heavy GC tracing everything or expensive RC for
each object.
The default is a minimal and a well performing tracing GC.
The second way is autofree, it can be enabled with `-autofree`. It takes care of most objects
(~90-100%): the compiler inserts necessary free calls automatically during compilation.
Remaining small percentage of objects is freed via GC. The developer doesn't need to change
anything in their code. "It just works", like in Python, Go, or Java, except there's no
heavy GC tracing everything or expensive RC for each object.
For developers willing to have more low level control, memory can be managed manually with
`-gc none`.
Arena allocation is available via v `-prealloc`.
### Control