Professional Web Applications Themes

memory allocation in perl - PERL Beginners

Hello Everyone! I would like to have your consideration regarding my query. I want to know about the memory allocation of variables in perl.. Thanks in advance. Regards, A+...

  1. #1

    Default memory allocation in perl

    Hello Everyone!

    I would like to have your consideration regarding my query. I want to
    know about the memory allocation of variables in perl..

    Thanks in advance.

    Regards,
    A+

    Anish Guest

  2. #2

    Default Re: memory allocation in perl

    Anish Mehta wrote: 

    You'll need to be more specific. There is no explicit memory allocation
    in perl (well, actually, you can treat a string as a chunk of memory).
    What exactly do you want to know?

    Randy.
    Randy Guest

  3. #3

    Default Re: memory allocation in perl

    > You'll need to be more specific. There is no explicit memory 


    I want to whether we have some sort of allocation method as we have in C
    where we have memory allocated from heap, stack for different types of
    memory allocations. As far as my knowledge in perl is concerned it
    runs C code internally. I am not getting how do a variable gets stored
    with perl.

    Thanks for your response.

    Regards..
    A+

    Anish Guest

  4. #4

    Default Re: memory allocation in perl

    Anish Mehta wrote: 
    >
    >
    >
    > I want to whether we have some sort of allocation method as we have in C
    > where we have memory allocated from heap, stack for different types of
    > memory allocations.[/ref]

    In perl there are only two basic ways to allocate variables. The package
    variable which would be roughly ogous to C's static variables and
    the 'my' variable which is allocated "on the stack" like auto variables
    in C. That's it as far as perl is concerned. As I alluded to in my
    previous post, you can treat a string like a chunk of memory:

    my $mem = ' ' x 1024;

    gives you a 1 kb chunk of "memory". You can then "store" and "retrieve"
    variables by using pack and unpack. It's rare that you would want to do
    this, however; the only thing that occurs off-hand is reading in a file
    that contains data encoded in a binary format.
     

    Perl doesn't run C code internally. It is implemented in C. The perl
    code is never translated to C.

    Randy Guest

Similar Threads

  1. #40701 [NEW]: Memory allocation error
    By michaeldaly at magma dot ca in forum PHP Bugs
    Replies: 25
    Last Post: April 25th, 07:56 PM
  2. Memory allocation on OS 9
    By neele in forum Mac Programming
    Replies: 3
    Last Post: February 18th, 03:23 PM
  3. How do i adjust memory allocation on mac osx for Freehand MX ??
    By James Noon in forum Macromedia Freehand
    Replies: 2
    Last Post: December 18th, 09:14 PM
  4. memory allocation problems in PHP and how to optimize?
    By lawrence in forum PHP Development
    Replies: 2
    Last Post: October 16th, 04:24 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139