Retroceder   Foros del Web > Temas generales de computación > Sistemas Operativos > BSD y Linux

Respuesta
 
Herramientas Desplegado
Antiguo 13-ene-2005, 10:07   #1 (permalink)
kapachov está en el buen camino
 
Avatar de kapachov
 
Fecha de Ingreso: diciembre-2002
Ubicación: Loeches
Mensajes: 464
Enviar un mensaje por ICQ a kapachov Enviar un mensaje por MSN a kapachov Enviar un mensaje por Yahoo  a kapachov Enviar un mensaje por Skype™ a kapachov
tamaño de *MYSQL Mensaje Previo

Holas...

antes que nada decir que he estado buscando en google y no encuentro mucha info para esclarecer el asunto Mr. Green Mr. Green Mr. Green Necesito saber cuanto espacio se reserva cuando crep variables de este tipo *MYSQL.

Si alguien sabe de alguna forma en C para darme cuenta [ de cuanto espacio se reserva ] y/o a visto que alguien a preguntado lo mismo que _YO_ [ y le han respondido ] le rogaria me enviara el link

Me imagino que ya hubo alguien que se puso en la tarea de sumar cada tipo de variable en la struc de :

typedef struct st_mysql {
NET net; /* Communication parameters */
gptr connector_fd; /* ConnectorFd for SSL */
char *host,*user,*passwd,*unix_socket,*server_version,* host_info,
*info,*db;
struct charset_info_st *charset;
MYSQL_FIELD *fields;
MEM_ROOT field_alloc;
my_ulonglong affected_rows;
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
my_ulonglong extra_info; /* Used by mysqlshow */
unsigned long thread_id; /* Id for connection in server */
unsigned long packet_length;
unsigned int port,client_flag,server_capabilities;
unsigned int protocol_version;
unsigned int field_count;
unsigned int server_status;
unsigned int server_language;
struct st_mysql_options options;
enum mysql_status status;
my_bool free_me; /* If free in mysql_close */
my_bool reconnect; /* set to 1 if automatic reconnect */
char scramble_buff[9];

/*
Set if this is the original connection, not a master or a slave we have
added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave()
*/
my_bool rpl_pivot;
/*
Pointers to the master, and the next slave connections, points to
itself if lone connection.
*/
struct st_mysql* master, *next_slave;

struct st_mysql* last_used_slave; /* needed for round-robin slave pick */
/* needed for send/read/store/use result to work correctly with replication */
struct st_mysql* last_used_con;
} MYSQL;

O la gente de MySQL previendo que alguien como _YO_ [ que formula preguntas a veces sin sentido ] quisiera saberlo, lo han puesto ya en su pagina pero no lo _VEO_

puede ser esto :

---
mysql: Out of memory at line 42, 'malloc.c'
mysql: needed 8136 byte (8k), memory in use: 12481367 bytes (12189k)
ERROR 2008: MySQL client ran out of memory
---
__________________
Siempre hago lo que quiero...
Aunque no quiera...
kapachov está desconectado   Responder Citando
Antiguo 13-ene-2005, 10:43   #2 (permalink)
kapachov está en el buen camino
 
Avatar de kapachov
 
Fecha de Ingreso: diciembre-2002
Ubicación: Loeches
Mensajes: 464
Enviar un mensaje por ICQ a kapachov Enviar un mensaje por MSN a kapachov Enviar un mensaje por Yahoo  a kapachov Enviar un mensaje por Skype™ a kapachov
Holas...

Me constesto:

/************************************************** **************************
*
* Purpose: Find out the size of the different data types
* Author: M J Leslie
* Date: 27-feb-94
*
************************************************** **************************/

#include <stdio.h>
main()
{
/*
* int/char are 'type specifiers'
* short/long are 'type qualifiers'
*/
int i;

printf(" short int is %2d bytes \n", sizeof(short int));
printf(" int is %2d bytes \n", sizeof(int));
printf(" int * is %2d bytes \n", sizeof(int *));
printf(" long int is %2d bytes \n", sizeof(long int));
printf(" long int * is %2d bytes \n", sizeof(long int *));
printf(" signed int is %2d bytes \n", sizeof(signed int));
printf(" unsigned int is %2d bytes \n", sizeof(unsigned int));
printf("\n");
printf(" float is %2d bytes \n", sizeof(float));
printf(" float * is %2d bytes \n", sizeof(float *));
printf(" double is %2d bytes \n", sizeof(double));
printf(" double * is %2d bytes \n", sizeof(double *));
printf(" long double is %2d bytes \n", sizeof(long double));
printf("\n");
printf(" signed char is %2d bytes \n", sizeof(signed char));
printf(" char is %2d bytes \n", sizeof(char));
printf(" char * is %2d bytes \n", sizeof(char *));
printf("unsigned char is %2d bytes \n", sizeof(unsigned char));
}


/************************************************** ***********
*
* The O/P from this program is
*
* short int is 2 bytes
* int is 4 bytes
* int * is 4 bytes
* long int is 4 bytes
* long int * is 4 bytes
* signed int is 4 bytes
* unsigned int is 4 bytes
*
* float is 4 bytes
* float * is 4 bytes
* double is 8 bytes
* double * is 4 bytes
* long double is 12 bytes
*
* signed char is 1 bytes
* char is 1 bytes
* char * is 4 bytes
* unsigned char is 1 bytes
*
*
************************************************** ************/

Esto estaba en mi Pc :

/usr/share/doc/HTML/en/kdevelop/reference/C/EXAMPLES/sizeof.c

La ayuda del sizeof me vino de mi jefe.
__________________
Siempre hago lo que quiero...
Aunque no quiera...
kapachov está desconectado   Responder Citando
Respuesta
No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 21:35.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

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