FAQ
Is there a way to make the underlining data of a channel or map in the data
section instead of on the heap?
Basically that means making the map and channel not allocate memory, but
use some buffer I'll supply myself and can put wherever I want.
Can it be done?

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Kyle Lemons at Aug 17, 2013 at 6:08 am
    Not at this point, I'm afraid. Can you explain for what purpose you would
    like this feature?

    On Thu, Aug 15, 2013 at 9:40 PM, Tal Shorer wrote:

    Is there a way to make the underlining data of a channel or map in the
    data section instead of on the heap?
    Basically that means making the map and channel not allocate memory, but
    use some buffer I'll supply myself and can put wherever I want.
    Can it be done?

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tal Shorer at Aug 17, 2013 at 8:20 am
    I need to know at compile time exactly how much memory the program is going
    to occupy.
    On Saturday, August 17, 2013 9:08:16 AM UTC+3, Kyle Lemons wrote:

    Not at this point, I'm afraid. Can you explain for what purpose you would
    like this feature?


    On Thu, Aug 15, 2013 at 9:40 PM, Tal Shorer <tal.s...@gmail.com<javascript:>
    wrote:
    Is there a way to make the underlining data of a channel or map in the
    data section instead of on the heap?
    Basically that means making the map and channel not allocate memory, but
    use some buffer I'll supply myself and can put wherever I want.
    Can it be done?

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rémy Oudompheng at Aug 17, 2013 at 8:23 am

    On 2013/8/17 Tal Shorer wrote:
    I need to know at compile time exactly how much memory the program is going
    to occupy.
    How does "static allocation" help you with that ? Did you write a
    program that doesn't do any memory allocation ?

    Rémy.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tal Shorer at Aug 17, 2013 at 8:27 am
    This can be achieved in C by using global arrays, structs and whatnot. Then
    use these arrays and never call a malloc-type function.
    Everything is going to be placed on the data section of the executable, so
    you know the size of memory your program is going to occupy before you run
    it.
    On Saturday, August 17, 2013 11:23:09 AM UTC+3, Rémy Oudompheng wrote:
    On 2013/8/17 Tal Shorer <tal.s...@gmail.com <javascript:>> wrote:
    I need to know at compile time exactly how much memory the program is going
    to occupy.
    How does "static allocation" help you with that ? Did you write a
    program that doesn't do any memory allocation ?

    Rémy.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Rémy Oudompheng at Aug 17, 2013 at 8:39 am

    On 2013/8/17 Tal Shorer wrote:
    This can be achieved in C by using global arrays, structs and whatnot. Then
    use these arrays and never call a malloc-type function.
    Everything is going to be placed on the data section of the executable, so
    you know the size of memory your program is going to occupy before you run
    it.
    What about stacks ? interfaces ? timers ? syscalls ? network ?

    Rémy.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tal Shorer at Aug 17, 2013 at 8:43 am
    Stack size was cleverly calculated to never overflow.
    The driver for each interface is sent a pointer to one of the statically
    allocated arrays.

    Network can be treated as an interface and so can the system.
    On Saturday, August 17, 2013 11:32:24 AM UTC+3, Rémy Oudompheng wrote:
    On 2013/8/17 Tal Shorer <tal.s...@gmail.com <javascript:>> wrote:
    This can be achieved in C by using global arrays, structs and whatnot. Then
    use these arrays and never call a malloc-type function.
    Everything is going to be placed on the data section of the executable, so
    you know the size of memory your program is going to occupy before you run
    it.
    What about stacks ? interfaces ? timers ? syscalls ? network ?

    Rémy.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Ian Lance Taylor at Aug 17, 2013 at 2:31 pm

    On Sat, Aug 17, 2013 at 1:27 AM, Tal Shorer wrote:
    This can be achieved in C by using global arrays, structs and whatnot. Then
    use these arrays and never call a malloc-type function.
    Everything is going to be placed on the data section of the executable, so
    you know the size of memory your program is going to occupy before you run
    it.
    Go has a number of operations that implicitly allocate, so this is
    quite a bit harder in Go. Putting channels and maps in the data
    section (which is not supported anyhow) would only handle a single
    case of implicit allocation.

    Ian

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dmitry Vyukov at Aug 17, 2013 at 9:03 am
    Just out of curiosity, why do you need this?
    If you need a hard upper limit, then the simplest way is to limit how much
    memory Go runtime allocates from OS.

    On Sat, Aug 17, 2013 at 12:20 PM, Tal Shorer wrote:

    I need to know at compile time exactly how much memory the program is
    going to occupy.
    On Saturday, August 17, 2013 9:08:16 AM UTC+3, Kyle Lemons wrote:

    Not at this point, I'm afraid. Can you explain for what purpose you
    would like this feature?

    On Thu, Aug 15, 2013 at 9:40 PM, Tal Shorer wrote:

    Is there a way to make the underlining data of a channel or map in the
    data section instead of on the heap?
    Basically that means making the map and channel not allocate memory, but
    use some buffer I'll supply myself and can put wherever I want.
    Can it be done?

    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts...@**googlegroups.com.

    For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
    .
    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedAug 17, '13 at 5:18a
activeAug 17, '13 at 2:31p
posts9
users5
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase