JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.68k stars 5.48k forks source link

doc: chapter on memory management #7546

Open StefanKarpinski opened 10 years ago

StefanKarpinski commented 10 years ago

As pointed out on julia-users, we don't really talk about memory management in our documentation at all. There should probably be a chapter in the manual talking about it.

ViralBShah commented 9 years ago

Commit f910cd04c96b55b702c474811809e03d613f8235 introduces some discussion on tracking memory allocation. It already existed as part of the profiling discussion in the stdlib section, but now is in the manual.

PallHaraldsson commented 9 years ago

[questions deleted, not important anymore, just wanted to make sure before I made a PR.]

yuyichao commented 9 years ago

Do we want to document this (implying it's somthing you need to/should know about..?)?

http://julia.readthedocs.org/en/latest/stdlib/libc/

Or even fix such with Compat.jl

https://github.com/JuliaLang/Compat.jl#other-changes https://github.com/JuliaLang/Compat.jl/blob/master/src/Compat.jl#L478

Please at least do some basic search, especially since you already mentioned the document and Compat.jl

PallHaraldsson commented 9 years ago

Yes, know about Libc documentation, it seems to say, just calls C. Sorry about Compat.jl, should have just checked. The question about Libc.* wasn't if it was documented, but if it was good enough. Should maybe have some warning or explain differences. I do not want to assume, if it doesn't say. I could document it, just want to be sure first.

yuyichao commented 9 years ago

AFAIK, Libc.* are just wrappers around the ccall to the libc functions. They have pretty much nothing to do with the GC and generic julia object. Just use them when you need to call the corresponding C functions. I'm not sure what is the part you are confused about but feel free to submit doc PR.

PallHaraldsson commented 9 years ago

Ok, thanks. So you can use Julia "as C without a GC" (and I assume it will stay that way forever). From scanning the Embedding docs (a while back), it seemed Julia does more.

Looking up Libc also show "Python function", "Python data", "Python module". Is that an error? Looking those up, is not helpful.. I assume it means something in relation to PyCall.. This could just be confusing to someone, if you had never heard of the Python language.

yuyichao commented 9 years ago

Ok, thanks. So you can use Julia "as C without a GC" (and I assume it will stay that way forever). From scanning the Embedding docs (a while back), it seemed Julia does more.

I suppose you mean "with a GC"? Just to be clear, julia GC doesn't really use malloc/free to manage memory.

Looking up Libc also show "Python function", "Python data", "Python module". Is that an error? Looking those up, is not helpful.. I assume it means something in relation to PyCall.. This could just be confusing to someone, if you had never heard of the Python language.

See https://github.com/rtfd/readthedocs.org/issues/1382 . Oh, well, I'm not sure what we can do about it ....

ihnorton commented 9 years ago

@PallHaraldsson: thanks for the interest, but these questions are not well-suited for the GitHub tracker. Please use the mailing list or StackOverflow, where answers are archived and searchable.

(the Python function thing has an existing doc issue open)

PallHaraldsson commented 9 years ago

I added #13517 from this understanding above. Not sure how I connect to this, or if I should. And I really meant "as C without a GC", that is is manual memory management also an option (even with GC, partly)., could be useful possibly for games/real-time use..

StefanKarpinski commented 4 years ago

Might still be good to have a non-expert section on memory management in the main manual. This discourse post might serve as a good starting point for such a section:

https://discourse.julialang.org/t/details-about-julias-garbage-collector-reference-counting/18021/3

ViralBShah commented 2 years ago

cc @chflood